schedule-bundle icon indicating copy to clipboard operation
schedule-bundle copied to clipboard

Fix single server locking

Open Matthew-Kilpatrick opened this issue 6 months ago • 1 comments

The existing behaviour auto-released the lock once the schedule:runcommand finished execution.

For short running tasks (~1 second or less), auto-releasing the lock can lead to a case where if a cron starts slightly later on another server, the lock from the first invocation has already been deleted, and the task is executed for a second time. For a cluster of 3 app servers running in the same datacenter using Redis to store locks, I've noticed this happening fairly frequenty on ~1 second jobs (~30% of the time).

This change relies on the DEFAULT_TTL constant to tidy-up locks rather than doing so in this extension. I'm not entirely sure this is the best way of handling things, so I'm open to other ideas!

Matthew-Kilpatrick avatar Oct 04 '25 17:10 Matthew-Kilpatrick

I'm glad you found this, because this saved me a couple of hours of figuring out why it wasn't working. Now i'm hoping this gets merged soon.

robotjoosen avatar Nov 27 '25 13:11 robotjoosen