When a Laravel 5 application goes down (planned maintenance or otherwise), but then it's brought back up a few minutes later, does Laravel automatically know to catch up and run those tasks that were missed?
If not, what is the preferred way to handle catchup for potentially missed tasks?
It appears that the task scheduling system is a bit too simple to ensure that a task runs after downtime (say, if it runs daily or at specific times); as advertised, it literally just runs tasks on the given schedule.
In essence, downtime / maintenance makes it possible to "miss the bus".
To ensure that critical tasks run:
if (time() > ($task->lastRunTime + $task->intervalTime)) dispatch(...)
or;if (time() >= $task->nextRunTime) dispatch(...)
Based on your application, the specific implementation of this will vary; the nice thing about using a model for this is that you can easily adapt it to your application's needs, such as tracking metrics.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With