Closed
Description
Description
Assume you have the following periodic task configured:
#[AsPeriodicTask(frequency: '1 minute', schedule: 'main', method: 'test')]
readonly class MyClass
{
public function test(): void
{
echo "test\n";
}
}
and the following Schedule:
#[AsSchedule('main')]
final readonly class MainSchedule implements ScheduleProviderInterface
{
public function __construct(
private CacheInterface $cache,
private LockFactory $lockFactory
) {}
public function getSchedule(): Schedule
{
return (new Schedule())
->stateful($this->cache)
->lock($this->lockFactory->createLock('main-scheduler'));
}
}
When running the worker for the first time the task is executed after 1 minute, and then runs every minute, as expected.
When closing the worker and restarting it, it continues on from where it left off (the task is executed after less than a minute). This is fine if you worker is online always.
Assume you leave the worker offline for 10 minutes, after starting it again the task will run 10 times, for every minute it missed.
This is not desired, if it missed a run it should run only once on startup of the worker and then run according to schedule again.
I was unable to find a configuration option or similar for this unfortunately.
Example
No response