Skip to content

Commit 52a1e54

Browse files
committed
add comment on setTimeout
1 parent ede97fd commit 52a1e54

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/electron/src/domain/rum/crashReporter.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,14 @@ export function startCrashMonitoring(onRumEventObservable: Observable<CollectedR
168168
uploadToServer: false, // We'll handle uploading via RUM
169169
})
170170

171-
// Wait for app to be ready before accessing crash dumps directory
171+
// https://www.electronjs.org/docs/latest/tutorial/performance#2-loading-and-running-code-too-soon
172+
// As crashes files accesses and parsing can be I/O and CPU intensive, delay them to not impact the main thread during startup
173+
// Crashes at startup have been observed on windows VM without the setTimeout
174+
// TODO:
175+
// - process files sequentially instead of in parallel to limit impact on resources
176+
// - stress test to see if it should be adapted
177+
// - consider offloading that to a different thread
172178
void app.whenReady().then(() =>
173-
// wait a bit more to prevent crash on windows ¯\_(ツ)_/¯
174179
setTimeout(() => {
175180
processCrashesFiles(onRumEventObservable, applicationId).catch(monitorError)
176181
}, ONE_SECOND)

0 commit comments

Comments
 (0)