-
Notifications
You must be signed in to change notification settings - Fork 34
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
strategy/periodic: support configuring a time zone for reboot windows #524
Conversation
Edit: outdated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added some comments in places I feel like needs some extra attention :)
src/strategy/mod.rs
Outdated
p.human_remaining() | ||
// If not using UTC, we cannot accurately calculate remaining time; | ||
// display next window week day and time, instead. | ||
if p.time_zone != tzfile::Tz::named("UTC").unwrap() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it makes sense to place this into a p.is_calendar_utc() -> bool
, caching the boolean upfront instead of re-computing it each time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We now have a p.tz_name()
that gets the "cached" name of the time zone. Using this over a boolean because we need to use this name in human_next_reboot_window()
too.
Include a single `time_zone` field (that defaults to UTC if not specified) in the `periodic` strategy's configuration. Whenever we need to check whether we're currently in an allowed reboot window, we convert the current naive time to the naive time under the specified time zone, and check whether we are currently in a reboot window. Under this implementation, we keep invariant clock time for reboots, but do NOT keep invariant reboot window length; thus, in some cases, reboot windows can be lengthened, shortened, or skipped entirely.
Thanks, @kelvinfan001! Looking forward to using this on my FCOS server. :) |
Same here! Thanks! |
Support configuring reboot windows defined by a user-specified time zone, instead of only UTC.
Include a single
time_zone
field (that defaults to UTC if notspecified) in the
periodic
strategy's configuration. Whenever weneed to check whether we're currently in an allowed reboot window,
we convert the current naive time to the naive time under the
specified time zone, and check whether we are currently in a reboot
window.
Under this implementation, we keep invariant clock time for reboots,
but do NOT keep invariant reboot window length; thus, in some cases,
reboot windows can be lengthened, shortened, or skipped entirely.