diff --git a/src/worker/index.ts b/src/worker/index.ts index 4a52063..f60c285 100644 --- a/src/worker/index.ts +++ b/src/worker/index.ts @@ -218,7 +218,13 @@ const schedulerWorker = new Worker( await priceUpdateQueue.add( 'update-price', { hashtagId: hashtag.id, tag: hashtag.tag }, - { jobId: `price-${hashtag.id}` }, // deduplicate by jobId + { + jobId: `price-${hashtag.id}`, // deduplicates against waiting/active (hash persists) + removeOnComplete: true, // remove hash on completion so jobId can be reused next sweep + removeOnFail: { count: 50 }, + attempts: 3, + backoff: { type: 'exponential', delay: 5000 }, + }, ) }