Commit 449de46
authored
fix(crash): handle sleep/wake appropriately (#5787)
## Problem:
When a user does a sleep then wake of their computer, the heartbeat is
not up to date since it cannot be sent when the user's computer is
asleep.
Due to this there is a race condition on wake between the next fresh
heartbeat being sent versus when we check the heartbeats to determine if
they are stale (crash). If the crash checker runs before a new heartbeat
can be sent, it will be seen as a crash.
## Solution:
Use a TimeLag class that helps to determine when there is a time
discrepancy. It works by updating a state every second, and if we
determine that the next update to that state took longer than a second,
we determine that there was a lag. Then we simply skip the next crash
check, allowing a fresh heartbeat to be sent.
---
<!--- REMINDER: Ensure that your PR meets the guidelines in
CONTRIBUTING.md -->
License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.
---------
Signed-off-by: nkomonen-amazon <[email protected]>1 parent af41d26 commit 449de46
File tree
5 files changed
+180
-126
lines changed- packages/core/src
5 files changed
+180
-126
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
| 167 | + | |
172 | 168 | | |
173 | 169 | | |
0 commit comments