preaction / Minion-Backend-mysql

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

Make "repair" more efficient #41

Closed larryl closed 12 months ago

larryl commented 12 months ago

The repair SQL to delete expired jobs and old jobs with no unresolved dependencies was basically scanning the whole minion_jobs table. Splitting it into two simper queries allows each of them to use the index on the "state" column (and only do the JOINs when actually needed), so overall it runs faster and reduces the likelihood of lock wait timeouts.

preaction commented 12 months ago

Looks good to me, thanks! I'll push this to PAUSE presently.