[5.4] Fix for withOverlapping, the scheduled task would not resume #19419
Conversation
…ror occurred. This adds a last resort handler to clean up the mutex bit if the application ended unexpectedly
|
My server froze the other day and one queue schedule didn't work after boot. Will this help for that? I had to manually clear it. |
|
It should, i had the same issues when developping a task that had an error. I got so annoyed by removing the withoutOverlapping part everytime so i investigated. This will always remove the mutex file if php ends normally. Even when it was by error, exception or voodoo.(slaughtered a chicken to test the last one) Only cases where it wont is if php is killed by a kill command from the system or powerloss/abrubt system power cycle. Then you might have to manually clean up. |
|
On second thought, with a server freeze php might not have terminated normally, so it wont fix it for that case. Depends fully on the circumstances |
|
@tschallacka Thanks for clarification on that. When this is released, I'll do some tests and see. I was going to suggest some sort of timescale for withoutOverlapping so it would ignore it if it's past that time. Not very familiar with scheduling code in the framework so not sure how viable that is. |
|
I would rather suggest creating an artisan command something like php artisan schedule:recover That will remove old task locks. And have a windows task/system event execute that in case of webserver service restart. |
|
Makes sense 👍 |
Fix for withOverlapping, the scheduled task would not resume if an error occurred.
This adds a last resort handler to clean up the mutex file if the application ended unexpectedly due to an fatal error.
Without this last ditch cleanup on application exit, the file will keep existing, and will not be cleaned up until the call ->withoutOverlapping() is removed from the scheduled task.