Hardcode queue name
This commit is contained in:
@ -65,8 +65,6 @@ interface BackendEnv {
|
||||
reminderTaskHanderUrl: string
|
||||
integrationTaskHandlerUrl: string
|
||||
textToSpeechTaskHandlerUrl: string
|
||||
textToSpeechName: string
|
||||
textToSpeechLocation: string
|
||||
}
|
||||
fileUpload: {
|
||||
gcsUploadBucket: string
|
||||
@ -96,6 +94,9 @@ interface BackendEnv {
|
||||
speechKey: string
|
||||
speechRegion: string
|
||||
}
|
||||
gcp: {
|
||||
location: string
|
||||
}
|
||||
}
|
||||
|
||||
/***
|
||||
@ -150,6 +151,7 @@ const nullableEnvVars = [
|
||||
'TEXT_TO_SPEECH_TASK_HANDLER_URL',
|
||||
'AZURE_SPEECH_KEY',
|
||||
'AZURE_SPEECH_REGION',
|
||||
'GCP_LOCATION',
|
||||
] // Allow some vars to be null/empty
|
||||
|
||||
/* If not in GAE and Prod/QA/Demo env (f.e. on localhost/dev env), allow following env vars to be null */
|
||||
@ -235,8 +237,6 @@ export function getEnv(): BackendEnv {
|
||||
reminderTaskHanderUrl: parse('REMINDER_TASK_HANDLER_URL'),
|
||||
integrationTaskHandlerUrl: parse('INTEGRATION_TASK_HANDLER_URL'),
|
||||
textToSpeechTaskHandlerUrl: parse('TEXT_TO_SPEECH_TASK_HANDLER_URL'),
|
||||
textToSpeechName: parse('TEXT_TO_SPEECH_QUEUE_NAME'),
|
||||
textToSpeechLocation: parse('TEXT_TO_SPEECH_QUEUE_LOCATION'),
|
||||
}
|
||||
const imageProxy = {
|
||||
url: parse('IMAGE_PROXY_URL'),
|
||||
@ -277,6 +277,10 @@ export function getEnv(): BackendEnv {
|
||||
speechRegion: parse('AZURE_SPEECH_REGION'),
|
||||
}
|
||||
|
||||
const gcp = {
|
||||
location: parse('GCP_LOCATION'),
|
||||
}
|
||||
|
||||
return {
|
||||
pg,
|
||||
client,
|
||||
@ -296,6 +300,7 @@ export function getEnv(): BackendEnv {
|
||||
sendgrid,
|
||||
readwise,
|
||||
azure,
|
||||
gcp,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -207,13 +207,15 @@ export const deleteTask = async (
|
||||
* @param userId - Id of the user authorized
|
||||
* @param saveRequestId - Id of the article_saving_request table record
|
||||
* @param priority - Priority of the task
|
||||
* @param queue - Queue name
|
||||
* @returns Name of the task created
|
||||
*/
|
||||
export const enqueueParseRequest = async (
|
||||
url: string,
|
||||
userId: string,
|
||||
saveRequestId: string,
|
||||
priority: 'low' | 'high' = 'high'
|
||||
priority: 'low' | 'high' = 'high',
|
||||
queue = env.queue.name
|
||||
): Promise<string> => {
|
||||
const { GOOGLE_CLOUD_PROJECT } = process.env
|
||||
const payload = {
|
||||
@ -247,6 +249,7 @@ export const enqueueParseRequest = async (
|
||||
payload,
|
||||
priority,
|
||||
taskHandlerUrl,
|
||||
queue,
|
||||
})
|
||||
if (!createdTasks || !createdTasks[0].name) {
|
||||
logger.error(`Unable to get the name of the task`, {
|
||||
@ -339,8 +342,8 @@ export const enqueueTextToSpeech = async ({
|
||||
priority,
|
||||
textType = 'ssml',
|
||||
bucket = env.fileUpload.gcsUploadBucket,
|
||||
queue = env.queue.textToSpeechName,
|
||||
location = env.queue.textToSpeechLocation,
|
||||
queue = 'omnivore-demo-text-to-speech-queue',
|
||||
location = env.gcp.location,
|
||||
}: {
|
||||
userId: string
|
||||
speechId: string
|
||||
|
||||
Reference in New Issue
Block a user