Closed twrichards closed 7 months ago
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 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.