Skip to content

Commit cf09c45

Browse files
perf2711Konrad Dysput
authored andcommitted
electron: fix potential loop with gpu-info-update (#330)
Co-authored-by: Sebastian Alex <sebastian.alex@saucelabs.com>
1 parent 94d27e8 commit cf09c45

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/electron/src/main/attributes/GpuAttributeProvider.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,16 @@ export class GpuAttributeProvider implements BacktraceAttributeProvider {
4949
private _attributes?: Record<string, unknown>;
5050

5151
constructor() {
52+
// getGPUInfo may not be supported on earlier versions of Electron
5253
if (!app.getGPUInfo) {
5354
return;
5455
}
5556

56-
app.on('gpu-info-update', () =>
57+
// Collect this information only once
58+
// getGPUInfo causes 'gpu-info-update' to be emitted again essentially causing a loop
59+
// https://github.com/electron/electron/issues/30827
60+
// It is unlikely to change again within runtime of the application
61+
app.once('gpu-info-update', () =>
5762
app
5863
.getGPUInfo('complete')
5964
.then((info) => {

0 commit comments

Comments
 (0)