You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: apps/webapp/app/v3/marqs/sharedQueueConsumer.server.ts
+3Lines changed: 3 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -295,6 +295,9 @@ export class SharedQueueConsumer {
295
295
messageId: message.messageId,
296
296
});
297
297
298
+
// INFO: There used to be a race condition where tasks could be triggered, but execute messages could be dequeued before the run finished being created in the DB
299
+
// This should not be happening anymore. In case it does, consider reqeueuing here with a brief delay while limiting total retries.
@@ -169,17 +169,23 @@ export class TriggerTaskService extends BaseService {
169
169
}
170
170
}
171
171
172
-
// We need to enqueue the task run into the appropriate queue
173
-
awaitmarqs?.enqueueMessage(
174
-
environment,
175
-
queueName,
176
-
taskRun.id,
177
-
{type: "EXECUTE",taskIdentifier: taskId},
178
-
body.options?.concurrencyKey
179
-
);
180
-
181
172
returntaskRun;
182
173
});
174
+
175
+
if(!run){
176
+
return;
177
+
}
178
+
179
+
// We need to enqueue the task run into the appropriate queue. This is done after the tx completes to prevent a race condition where the task run hasn't been created yet by the time we dequeue.
0 commit comments