From 7bd99e8fcbe29a36222edd8d5b60088c61845103 Mon Sep 17 00:00:00 2001 From: Mike Johnston Date: Wed, 18 Mar 2026 20:59:34 -0400 Subject: [PATCH] feat: enhance price update job handling with deduplication and retry logic --- src/worker/index.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 }, + }, ) }