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

Account for setTimeout timers pausing during system sleep #108

Open
jonathanmayer opened this issue Jun 10, 2021 · 0 comments
Open

Account for setTimeout timers pausing during system sleep #108

jonathanmayer opened this issue Jun 10, 2021 · 0 comments

Comments

@jonathanmayer
Copy link
Contributor

When the system goes to sleep, timers set with setTimeout (and setInterval) suspend and start ticking again on wake. We should account for this in a couple places.

  • In the scheduling module, rather than using lengthy timers to handle corner cases for the onIdleDaily and onIdleWeekly events, we should use shorter interval timers. With the current approach, there could be a corner case where the browser is idle 24 hours after the last onIdleDaily event and the system has been asleep in the last 24 hours. In that scenario, the event might not fire at the preferred time—it will fire when 24 hours (excluding sleep) have elapsed or when the browser next transitions from active to idle. Since this is an event that only fires at an approximate time, and since this is a corner case, not a big deal—but worth addressing eventually. We should also switch to alarms for future proofing.
  • In the idle module, we should clearly document that the idle detection period doesn't include time when the system is asleep. We should also clearly document that the semantics of idle vary by platform.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant