From 7c3d85d6c55235e7fd5de52f87e72eb3fc1824df Mon Sep 17 00:00:00 2001 From: Sanjays2402 <51058514+Sanjays2402@users.noreply.github.com> Date: Fri, 29 May 2026 03:25:49 -0700 Subject: [PATCH] Fix #3107: throttle active-session external-refresh poll from 5s to 30s The active-session 'is it externally updated?' fallback poll fires every 5 s. On long sessions this causes visible scroll churn (the rendered message list is rebuilt and the scrollTop is restored on a 5-second cadence) and a measurable network/CPU floor even when the user is just reading. This poll is a *fallback* for the case where the SSE session-events stream is unavailable; SSE already invalidates the active session in real time. Pushing it to 30 s keeps the safety net for SSE-broken environments without it acting as a primary refresh path. Regression introduced in 467ef33a. --- static/sessions.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/static/sessions.js b/static/sessions.js index 8f3ec00c..fc90f1f5 100644 --- a/static/sessions.js +++ b/static/sessions.js @@ -2309,7 +2309,13 @@ let _gatewaySSEWarningShown = false; const _gatewayFallbackPollMs = 30000; const _streamingPollMs = 5000; const _sessionTimeRefreshMs = 60000; -const _activeSessionExternalRefreshMs = 5000; +// #3107: the active-session "is it externally updated?" poll used to fire +// every 5 s. On long sessions this caused visible scroll jitter and a +// noticeable network/CPU floor because the SSE session-events stream +// already pushes invalidations in real time; this poll exists only as a +// fallback for the case where SSE is broken/unavailable. Bump to 30 s +// to keep the safety net without turning it into a primary refresh path. +const _activeSessionExternalRefreshMs = 30000; let _streamingPollTimer = null; let _sessionTimeRefreshTimer = null; let _activeSessionExternalRefreshTimer = null;