-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make reaper schedule behave more like cron #4197
Conversation
4fcaca6
to
302ea86
Compare
… is redeployed, i.e. behave more like cron
302ea86
to
a145fba
Compare
Seen on cropper, kahuna, auth, metadata-editor (merged by @twrichards 9 minutes and 55 seconds ago) Please check your changes! |
Seen on image-loader, usage (merged by @twrichards 10 minutes and 3 seconds ago) Please check your changes! |
Seen on leases, media-api (merged by @twrichards 10 minutes and 8 seconds ago) Please check your changes! |
Seen on collections, thrall (merged by @twrichards 10 minutes and 15 seconds ago) Please check your changes! |
Seen on collections (merged by @twrichards 10 minutes and 15 seconds ago) Please check your changes! |
Seen on collections, thrall (merged by @twrichards 10 minutes and 16 seconds ago) Please check your changes! |
We noticed that the
SoftReapingTooMuch
&HardReapingTooMuch
alarms (added in https://github.com/guardian/editorial-tools-platform/pull/712) were firing on re-deploys of the grid, since reaper was running with no delay on startup then every 15mins thereafter. We decided that best to ensure reaper only runs at the interval specified as that makes it easier to reason about (and changing the alarms would be hard without compromising their utility/promptness).What does this change?
This introduces a util function for finding the time/duration until the next instance of an interval, past the hour... e.g. if 'now' is 11:11:31 then the next instance of the interval will be 11:15:00 and so the duration until then is 3min 29sec. This functionality has tests 🎉 .
This function is then used for the
initialDelay
when starting the reaper schedule inthrall
.How should a reviewer test this change?
Do multiple deploys to
TEST
in quick succession and see that reaper still only runs (can be observed via CloudWatch metrics:SoftReaped
&HardReaped
) on 00, 15, 30 & 45 mins past the hour.