preaction / Minion-Backend-mysql

MySQL backend for the 🐙 Minion job runner
Other
7 stars 14 forks source link

Race condition when enqueueing jobs with parents? #34

Closed tn-laslov closed 3 years ago

tn-laslov commented 3 years ago

We've seen an (very infrequent) issue where a job with a parent is executed immediately when enqueued, despite the parent job still being inactive.

Looking at the enqueue code it seems the inserts are not done in a transaction and there's an opening for a worker to pick up the job before the parent relationship is established?

preaction commented 3 years ago

Oh wow, yeah, that sounds absolutely the case. Sounds like a pretty simple fix, too, so I'll try to get this out in the next couple days.