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
Hi. The effect I am trying to achieve is to have only a single job enqueued for a given set of arguments. However, if a job with the same arguments is currently in the running state, I would like a new instance to be enqueued. This is because the currently running job probably won't see the new information that had just been added to the database.
I thought I would be able to achieve this by removing JobStateRunning from the unique-by-state list but it turns out that it is one of the mandatory states that must exist in that list.
The only other way I could think to achieve this is to list the jobs of the kind and, if there's a job in the running state, keep retrying the job insertion until it succeeds. That feels like a brittle solution though. Do you have any better suggestions for addressing this kind of scenario?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi. The effect I am trying to achieve is to have only a single job enqueued for a given set of arguments. However, if a job with the same arguments is currently in the running state, I would like a new instance to be enqueued. This is because the currently running job probably won't see the new information that had just been added to the database.
I thought I would be able to achieve this by removing
JobStateRunning
from the unique-by-state list but it turns out that it is one of the mandatory states that must exist in that list.The only other way I could think to achieve this is to list the jobs of the kind and, if there's a job in the running state, keep retrying the job insertion until it succeeds. That feels like a brittle solution though. Do you have any better suggestions for addressing this kind of scenario?
Beta Was this translation helpful? Give feedback.
All reactions