Some of my scheduled tasks haven't been running when using Laravel
This is because they've been set to run:
->withoutOverlapping()
More can be read about this here: http://ift.tt/1T0PLJ8
When this is used a file is put in storage when it starts running and removed when it's done and there is a check for the existence of the file when it tries to run, if it exists it won't run again.
Clearly if the file is still there and preventing the command from running some sort of error caused the application to exit before the file was removed.
However the file is simply named an md5 hash. Of what i'm not 100% sure. It's created using the mutexPath() function in Illuminate/Console/Scheduling/Event.php
public function mutexPath()
{
return storage_path('framework/schedule-'.md5($this->expression.$this->command));
}
Exactly what $this->expression and $this->command are isn't obvious since they're created throughout a range of files and classes which i've been trying to follow for a few hours with very little luck.
What i'd like is for some way to scandir the storage/framework dir and remove any old cache files. This is simple enough, but isn't helpful long term. What I then need to do is figure out which command the old cache file in storage is related to so that I can debug which ones aren't being deleted and why.
Preferably this would involve some way of looping through all the scheduled commands in App/Console/Kernel.php and listing which ones have an overlap file listed and which don't.
But I have no idea how to do this because it's obfuscated in different classes and many of the functions appear to be protected or private, preventing a simple loop through of all the scheduled tasks.
Has anyone encountered that before? Is there any way to get the cache filename (from the mutexPath() function) to do an easy file_exists() check? What's the best way of managing whether these non overlapping scheduled tasks are actually running and not being perpetually blocked by an old file that wasn't deleted?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire