Skip to content

Commit ae08ba4

Browse files
Code2Collapseclaude
andcommitted
Doctor: pause the 2s GPU/system poll while the tab is hidden
No point fetching /system_stats and allocating sample objects every 2s when the tab isn't visible. Resumes on focus. Small steady-state allocation cut. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> (cherry picked from commit 502612c)
1 parent 73fe9f2 commit ae08ba4

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

js/c2c_doctor.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,9 @@ function _gpuPollOnce() {
204204
function _ensureGpuPolling() {
205205
if (_gpuPollTimer != null) return;
206206
_gpuPollOnce();
207-
_gpuPollTimer = setInterval(_gpuPollOnce, 2000);
207+
// Skip the /system_stats fetch while the tab is hidden — no point polling
208+
// (and allocating sample objects) when nobody's looking. Resumes on focus.
209+
_gpuPollTimer = setInterval(() => { if (!document.hidden) _gpuPollOnce(); }, 2000);
208210
}
209211

210212
// ---------------------------------------------------------------------------

0 commit comments

Comments
 (0)