Merge pull request #3502 from omnivore-app/fix/bullmq-job-retry-backoff

increase the seed valud of backoff delay to 2 seconds
This commit is contained in:
Hongbo Wu 2024-02-06 15:09:40 +08:00 committed by GitHub
commit 468f835f9e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 12 additions and 16 deletions

View file

@ -137,8 +137,6 @@ export const queueRSSRefreshFeedJob = async (
}
return queue.add('refresh-feed', payload, {
jobId: jobid,
removeOnComplete: true,
removeOnFail: true,
priority: options.priority == 'low' ? 10 : 50,
})
}

View file

@ -49,6 +49,18 @@ export const getBackendQueue = async (): Promise<Queue | undefined> => {
}
backendQueue = new Queue(QUEUE_NAME, {
connection: redisDataSource.workerRedisClient,
defaultJobOptions: {
backoff: {
type: 'exponential',
delay: 2000, // 2 seconds
},
removeOnComplete: {
age: 24 * 3600, // keep up to 24 hours
},
removeOnFail: {
age: 7 * 24 * 3600, // keep up to 7 days
},
},
})
await backendQueue.waitUntilReady()
return backendQueue

View file

@ -666,8 +666,6 @@ export const enqueueTriggerRuleJob = async (data: TriggerRuleJobData) => {
return queue.add(TRIGGER_RULE_JOB_NAME, data, {
priority: 5,
attempts: 1,
removeOnComplete: true,
removeOnFail: true,
})
}
@ -680,8 +678,6 @@ export const enqueueWebhookJob = async (data: CallWebhookJobData) => {
return queue.add(CALL_WEBHOOK_JOB_NAME, data, {
priority: 5,
attempts: 1,
removeOnComplete: true,
removeOnFail: true,
})
}
@ -698,10 +694,6 @@ export const bulkEnqueueUpdateLabels = async (data: UpdateLabelsData[]) => {
jobId: `${UPDATE_LABELS_JOB}_${d.libraryItemId}`,
attempts: 6,
priority: 1,
backoff: {
type: 'exponential',
delay: 1000,
},
},
}))
@ -724,10 +716,6 @@ export const enqueueUpdateHighlight = async (data: UpdateHighlightData) => {
jobId: `${UPDATE_HIGHLIGHT_JOB}_${data.libraryItemId}`,
attempts: 6,
priority: 1,
backoff: {
type: 'exponential',
delay: 1000,
},
})
} catch (error) {
logger.error('error enqueuing update highlight job', error)
@ -747,8 +735,6 @@ export const enqueueBulkAction = async (data: BulkActionData) => {
attempts: 1,
priority: 10,
jobId, // deduplication
removeOnComplete: true,
removeOnFail: true,
})
} catch (error) {
logger.error('error enqueuing bulk action job', error)