Skip to content

Commit f7822ab

Browse files
heartbeat - delete before overwrite
Handles a possible edge case when sending a heartbeat Signed-off-by: nkomonen-amazon <[email protected]>
1 parent 36b7e54 commit f7822ab

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/core/src/shared/crashMonitoring.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,10 @@ export class FileSystemState {
463463
const func = async () => {
464464
const filePath = this.makeStateFilePath(extId)
465465

466+
// We were seeing weird behavior where we possibly read an old file, even though we overwrote it.
467+
// So this is a sanity check.
468+
await fs.delete(filePath, { force: true })
469+
466470
await fs.writeFile(filePath, JSON.stringify({ ...this.ext, lastHeartbeat: now }, undefined, 4))
467471

468472
// Sanity check to verify the write is accessible immediately after

0 commit comments

Comments
 (0)