Skip to content

Commit 449de46

Browse files
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 <nkomonen@amazon.com>
1 parent af41d26 commit 449de46

File tree

5 files changed

+180
-126
lines changed

5 files changed

+180
-126
lines changed

packages/core/src/shared/constants.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,6 @@ export const amazonQVscodeMarketplace =
164164
*
165165
* Moved here to resolve circular dependency issues.
166166
*/
167-
export const crashMonitoringDirNames = {
168-
root: 'crashMonitoring',
169-
running: 'running',
170-
shutdown: 'shutdown',
171-
} as const
167+
export const crashMonitoringDirName = 'crashMonitoring'
172168

173169
export const amazonQTabSuffix = '(Generated by Amazon Q)'

0 commit comments

Comments
 (0)