Skip to content

Preventing parallel run of two tasks with same cache key #9842

Closed Answered by argibbs
argibbs asked this question in Q&A
Discussion options

You must be logged in to vote

Self-answering for benefit of future generations:

Concurrency limits are the answer. It's messy, but what I'm doing is immediately before launching the task, I'm generating a unique identifier for the task (basically, the cache_key) and then making a POST to the server to set the concurrency limit to 1 for that identifier (n.b. most times it'll already be set, but it's the only way to be sure).

Then I simply add the identifier as a tag on the task, and I'm done.

Works exactly how I wanted - Flow2 is active, but Flow2/TaskABC doesn't get run until Flow1/TaskABC is done, at which point it sees the cached value and skips. The GUI could do with an indication that the task wants to run but is …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by argibbs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant