We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ba3cf1c commit c3af061Copy full SHA for c3af061
1 file changed
workers/grouper/src/index.ts
@@ -53,6 +53,11 @@ const DB_DUPLICATE_KEY_ERROR = '11000';
53
*/
54
const MAX_CODE_LINE_LENGTH = 140;
55
56
+/**
57
+ * Delay in milliseconds to wait for duplicate key event to be persisted to database
58
+ */
59
+const DUPLICATE_KEY_RETRY_DELAY_MS = 10;
60
+
61
/**
62
* Worker for handling Javascript events
63
@@ -239,7 +244,7 @@ export default class GrouperWorker extends Worker {
239
244
* Fetch the event that was just inserted by the competing worker
240
245
* Add small delay to ensure the event is persisted
241
246
242
- await new Promise(resolve => setTimeout(resolve, 10));
247
+ await new Promise(resolve => setTimeout(resolve, DUPLICATE_KEY_RETRY_DELAY_MS));
243
248
249
existedEvent = await this.getEvent(task.projectId, uniqueEventHash);
250
0 commit comments