We have a use case where multiple background tasks are queued rapidly with the same sequential key (e.g., tasks for periods 6–12). Does the system guarantee execution in order (6, 7, 8, etc.), or only ensure they don’t run concurrently?
Hi Dheivya!
All Jobs with the same Sequential Execution ID will be executed in the same order that they were submitted in.
This means that a single piece of logic that queues a task for each period between 6 and 12 will lead to seven tasks that execute in exactly that order (6, 7, 8, etc.).
On the other hand, different threads of logic executing at the same time that queue the same background task with the same key will have varied results. Even though one thread begins executing first, the thread that first hits the Queue Background Task option or commits its transaction [in the case of a Queue Immediately action] will get preference. This means that when different threads each concurrently queue the same task with the same key, the order of execution is not guaranteed.