Improved execution of scheduled events on startup #42

Closed
opened 2019-03-21 23:37:01 +00:00 by jamie · 4 comments
jamie commented 2019-03-21 23:37:01 +00:00 (Migrated from git.hazaar.io)

When warlock starts up, any events that are due to be executed on a repeating schedule that is currently active, will execute immediately because they have no last execution time. I would like to make this a bit smarter. Something like only do it if the last scheduled time is less than a certain period (or percentage of the delay time) ago. This means that if these events we ONLY JUST supposed to be executed a short time ago, they will be executed, but if they are not supposed to execute for a few hours or something, then they will not.

Alternatively, I could just make it so that if the event has not be executed before then it will not execute on startup but will instead exec at the next scheduled time. This could be "phase 1".

When warlock starts up, any events that are due to be executed on a repeating schedule that is currently active, will execute immediately because they have no last execution time. I would like to make this a bit smarter. Something like only do it if the last scheduled time is less than a certain period (or percentage of the delay time) ago. This means that if these events we ONLY JUST supposed to be executed a short time ago, they will be executed, but if they are not supposed to execute for a few hours or something, then they will not. Alternatively, I could just make it so that if the event has not be executed before then it will not execute on startup but will instead exec at the next scheduled time. This could be "phase 1".
jamie commented 2019-03-21 23:37:55 +00:00 (Migrated from git.hazaar.io)

changed the description

changed the description
jamie commented 2019-03-22 04:38:42 +00:00 (Migrated from git.hazaar.io)

All sorted. This was fixed in both MVC and here. Basically the \Hazaar\Cron class was not really handling the next occurrence correctly, which meant that for a whole minute the "next" occurrence could be the current minute, which is not desirable. I made a small tweak that means the checking the next occurrence calculates of the following minute and everything appears to work. Warlock services just needed the $exec['when'] + 60 code to be removed so that the reference time is the next minute after now.

All sorted. This was fixed in both MVC and here. Basically the `\Hazaar\Cron` class was not really handling the next occurrence correctly, which meant that for a whole minute the "next" occurrence could be the current minute, which is not desirable. I made a small tweak that means the checking the next occurrence calculates of the following minute and everything appears to work. Warlock services just needed the `$exec['when'] + 60` code to be removed so that the reference time is the next minute after `now`.
jamie commented 2019-03-22 04:38:42 +00:00 (Migrated from git.hazaar.io)

closed

closed
jamie commented 2020-04-14 23:30:32 +00:00 (Migrated from git.hazaar.io)

mentioned in commit fa45447153

mentioned in commit fa4544715346eec34b2c5426d94d7a8de0a91e41
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: hazaar/hazaar-warlock#42
No description provided.