diff --git a/src/config/config-worker.ts b/src/config/config-worker.ts index 693451e0..ae6ee3f9 100644 --- a/src/config/config-worker.ts +++ b/src/config/config-worker.ts @@ -12,6 +12,12 @@ export const WorkerConfig = { port: Number(environment.REDIS_PORT), }, moveContactQueue: 'MOVE_CONTACT_QUEUE', + defaultJobOptions: { + attempts: 3, // Max retries for a failed job + backoff: { + type: 'custom', + }, + } }; const assertRedisConfig = () => { diff --git a/src/lib/queues.ts b/src/lib/queues.ts index 2b68de2a..398495d4 100644 --- a/src/lib/queues.ts +++ b/src/lib/queues.ts @@ -1,5 +1,5 @@ import { v4 } from 'uuid'; -import { JobsOptions, Queue, ConnectionOptions } from 'bullmq'; +import { JobsOptions, Queue, ConnectionOptions, DefaultJobOptions } from 'bullmq'; import { WorkerConfig } from '../config/config-worker'; export interface IQueue { @@ -17,9 +17,9 @@ export class BullQueue implements IQueue { public readonly name: string; public readonly bullQueue: Queue; - constructor(queueName: string, connection: ConnectionOptions) { + constructor(queueName: string, connection: ConnectionOptions, defaultJobOptions?: DefaultJobOptions) { this.name = queueName; - this.bullQueue = new Queue(queueName, { connection }); + this.bullQueue = new Queue(queueName, { connection, defaultJobOptions }); } public async add(jobParams: JobParams): Promise { @@ -37,5 +37,6 @@ export class BullQueue implements IQueue { export const getMoveContactQueue = () => new BullQueue( WorkerConfig.moveContactQueue, - WorkerConfig.redisConnection + WorkerConfig.redisConnection, + WorkerConfig.defaultJobOptions ); diff --git a/src/liquid/place/move_form.html b/src/liquid/place/move_form.html index 2788ed5a..59fb15c5 100644 --- a/src/liquid/place/move_form.html +++ b/src/liquid/place/move_form.html @@ -54,7 +54,12 @@

To