diff --git a/source/SIL.AppBuilder.Portal/common/bullmq.ts b/source/SIL.AppBuilder.Portal/common/bullmq.ts index aed41b369..2046edb0b 100644 --- a/source/SIL.AppBuilder.Portal/common/bullmq.ts +++ b/source/SIL.AppBuilder.Portal/common/bullmq.ts @@ -1,15 +1,18 @@ import { Queue } from 'bullmq'; import type { ScriptoriaJob } from './BullJobTypes.js'; -export type QueueName = 'scriptoria' | 'default recurring'; +export enum QueueName { + Scriptoria = 'scriptoria', + DefaultRecurring = 'default recurring' +}; -export const scriptoria = new Queue('scriptoria' as QueueName, { +export const scriptoria = new Queue(QueueName.Scriptoria, { connection: { host: process.env.NODE_ENV === 'development' ? 'localhost' : 'redis' } }); -export const default_recurring = new Queue('default recurring' as QueueName, { +export const default_recurring = new Queue(QueueName.DefaultRecurring, { connection: { host: process.env.NODE_ENV === 'development' ? 'localhost' : 'redis' } diff --git a/source/SIL.AppBuilder.Portal/node-server/dev.ts b/source/SIL.AppBuilder.Portal/node-server/dev.ts index 9ff9e6cdf..6842c73fe 100644 --- a/source/SIL.AppBuilder.Portal/node-server/dev.ts +++ b/source/SIL.AppBuilder.Portal/node-server/dev.ts @@ -20,5 +20,5 @@ app.listen(3000, () => console.log('Dev server started')); addDefaultRecurringJobs(); -new ScriptoriaWorker('scriptoria'); -new ScriptoriaWorker('default recurring'); +new ScriptoriaWorker(queues.QueueName.Scriptoria); +new ScriptoriaWorker(queues.QueueName.DefaultRecurring); diff --git a/source/SIL.AppBuilder.Portal/node-server/index.ts b/source/SIL.AppBuilder.Portal/node-server/index.ts index 0707a9c65..3cd939438 100644 --- a/source/SIL.AppBuilder.Portal/node-server/index.ts +++ b/source/SIL.AppBuilder.Portal/node-server/index.ts @@ -76,8 +76,8 @@ import { BullMQ, queues } from 'sil.appbuilder.portal.common'; // Running on svelte process right now. Consider putting on new thread // Fine like this if majority of job time is waiting for network requests // If there is much processing it should be moved to another thread -new ScriptoriaWorker('scriptoria'); -new ScriptoriaWorker('default recurring'); +new ScriptoriaWorker(queues.QueueName.Scriptoria); +new ScriptoriaWorker(queues.QueueName.DefaultRecurring); const serverAdapter = new ExpressAdapter(); serverAdapter.setBasePath('/admin/jobs');