Skip to content
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

Merged
merged 1 commit into from
Nov 27, 2023

Conversation

twrichards
Copy link
Contributor

@twrichards twrichards commented Nov 22, 2023

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 in thrall.

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.

@twrichards twrichards requested a review from a team as a code owner November 22, 2023 11:34
Copy link

github-actions bot commented Nov 22, 2023

@twrichards twrichards force-pushed the reaper-cron-like-schedule branch 2 times, most recently from 4fcaca6 to 302ea86 Compare November 22, 2023 18:11
@twrichards twrichards changed the base branch from main to reaper/ui-monospace-display November 22, 2023 18:12
Base automatically changed from reaper/ui-monospace-display to main November 24, 2023 10:04
@twrichards twrichards force-pushed the reaper-cron-like-schedule branch from 302ea86 to a145fba Compare November 24, 2023 10:05
@prout-bot
Copy link

Seen on cropper, kahuna, auth, metadata-editor (merged by @twrichards 9 minutes and 55 seconds ago) Please check your changes!

@prout-bot
Copy link

Seen on image-loader, usage (merged by @twrichards 10 minutes and 3 seconds ago) Please check your changes!

@prout-bot
Copy link

Seen on leases, media-api (merged by @twrichards 10 minutes and 8 seconds ago) Please check your changes!

@prout-bot
Copy link

Seen on collections, thrall (merged by @twrichards 10 minutes and 15 seconds ago) Please check your changes!

@prout-bot
Copy link

Seen on collections (merged by @twrichards 10 minutes and 15 seconds ago) Please check your changes!

@prout-bot
Copy link

Seen on collections, thrall (merged by @twrichards 10 minutes and 16 seconds ago) Please check your changes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants