Notification bell polling ignores tab visibility and has no backoff #59

Open
opened 2026-08-31 21:40:11 -04:00 by jared · 0 comments
Owner

Severity: Low

views/layout_footer.php (~line 266): setInterval(loadNotifications, 60000) runs unconditionally, with no Page Visibility API check (document.hidden) to pause while the tab is backgrounded. loadNotifications()'s .catch() (~lines 241-243) just shows "Could not load" and lets the next 60s tick retry at the same fixed cadence, with no exponential backoff if the server is genuinely down.

Low impact (one request/minute/tab) but scales linearly with idle background tabs left open, and hammers a genuinely-down server at a fixed rate instead of backing off.

Fix: Pause polling via document.addEventListener('visibilitychange', ...) when hidden, and add simple exponential backoff on repeated poll failures.

**Severity:** Low `views/layout_footer.php` (~line 266): `setInterval(loadNotifications, 60000)` runs unconditionally, with no Page Visibility API check (`document.hidden`) to pause while the tab is backgrounded. `loadNotifications()`'s `.catch()` (~lines 241-243) just shows "Could not load" and lets the next 60s tick retry at the same fixed cadence, with no exponential backoff if the server is genuinely down. Low impact (one request/minute/tab) but scales linearly with idle background tabs left open, and hammers a genuinely-down server at a fixed rate instead of backing off. **Fix:** Pause polling via `document.addEventListener('visibilitychange', ...)` when hidden, and add simple exponential backoff on repeated poll failures.
jared added the performancepriority/low labels 2026-09-08 10:15:46 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: LotusGuild/tinker_tickets#59