pulse-outdated
pulse-outdated copied to clipboard
Dynamic Scheduling
Problem
Currently, the command only runs at midnight. This is not a problem if Pulse runs at exactly midnight. However, at the moment I cannot influence this value, for example setting it to dawn or night. When installing the package, I have to wait a day for the first result. Although this is not a problem since I can run the command myself, it would be more convenient to customize the package.
Solution
I replaced the fixed time check with a cron-based check that allows any scheduling using the cron syntax.
The default cron expression 0 0 * * *
means it runs every day at midnight (so the current logic remains the same).
However, in the config/pulse.php
file, when declaring the Recorder, a parameter called cron can be specified, which overrides this value.
return [
// ...
'recorders' => [
\AaronFrancis\Pulse\Outdated\Recorders\OutdatedRecorder::class => [
+ 'cron' => '0 15 * * *' // schedule: every day at 3 PM
],
]
]