From e95f64663078b2d30192ea34b15f924f2501f79a Mon Sep 17 00:00:00 2001 From: Tarashish Mishra Date: Thu, 18 Apr 2024 18:37:10 +0530 Subject: [PATCH] Update processing state before we start processing this prevent parallel workers from picking up duplicate work --- update.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update.js b/update.js index 67a7c50..30100ca 100644 --- a/update.js +++ b/update.js @@ -22,10 +22,10 @@ const process = async () => { // Now check the queue and pick a file to process let toProcess = await getReplicationToProcess(); while (toProcess) { + await setProcessedState(toProcess); console.log(`Processing replication file ${toProcess}`); await run(toProcess); console.log(`Finished processing replication file ${toProcess}`); - await setProcessedState(toProcess); toProcess = await getReplicationToProcess(); } };