-
Notifications
You must be signed in to change notification settings - Fork 103
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
refactor power_event_watcher for configurable subscriber behavior #1764
Conversation
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 like this approach! Just had a nit about naming
|
||
// knapsackSubscriber implements the powerEventSubscriber interface and | ||
// updates the knapsack.InModernStandby state based on the power events observed | ||
knapsackSubscriber struct { |
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.
This might just be me, but I was confused because knapsackSubscriber
sounds like something subscribing to the knapsack and not (effectively) the knapsack subscribing to something else. What about something like knapsackUpdater
(or something along those lines but more specific, like knapsackSleepStateUpdater
)?
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.
oh yeah, that makes more sense thank you. will do knapsackSleepStateUpdater
57d1252
to
ba831ce
Compare
To support the windows watchdog efforts, we will be re-using the
power_event_watcher
code from the watchdog service. Currently the power_event_watcher component takes a knapsack reference and directly manipulates theInModernStandby
value as a result of the observed events. These are also persisted to bbolt, making this a little tricky for sharing with a separate service as is.We can't simply read the values from bbolt within watchdog because if launcher proper stops functioning (and requires watchdog intervention) we shouldn't trust the latest stored value.
We also likely won't want two versions of the same logs always being added from both watchdog and launcher, and I didn't want to just duplicate all of this code. This was the cleanest approach I could come up with, and should allow watchdog to simply define a new
powerEventSubscriber
(and avoid knapsack/stores setup). happy to hear any alternative suggestions!