Join GitHub today
Obtain advisory lock before updating or deleting jobs #28
If we have a failed Que job and press the re-run button when the job is being retried by a worker, we end up scheduling another instance of the job. Similarly, if we try to delete a previously-failed job and it is already being retried, we won't actually delete the job despite the flash telling us that is was deleted.
Both of these scenarios are confusing, and should be avoided (and a warning shown to the user).
The former occurs as when we reschedule a running job, we change the primary key of the job as it is a composite of:
To fix both scenarios, if we try to take the advisory lock for the job before updating/deleting, we will only reschedule/delete if the job isn't already being worked. This PR adds this attempted locking and shows a flash to accurately describe to the user what has happened.
N.B. to demonstrate the issue a job such as:
will error first time, if the reschedule button is pressed when it starts running, (i.e. printing
On Thu, Oct 12, 2017 at 5:23 PM Jason Staten ***@***.***> wrote: Published as 0.6.0 <https://rubygems.org/gems/que-web/versions/0.6.0> — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#28 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AAH1KvZuaucuFnvHIdo-KXB0bFyCa89Uks5sroNSgaJpZM4Pvcxu> .