You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(stats): overview polling overlaps ticks, reorders samples and hides errors; one shared polling controller #1570
Each one does Timer.periodic(interval, (_) => unawaited(_onPollTick())) (also in syncTickerGatedPeriodicTimer, lib/core/motion/ticker_gated_polling.dart:23):
Ticks overlap. A tick does not wait for the previous one. When the server is slow, requests pile up on it exactly when it is struggling. For extension drivers the RPC timeout defaults to 60 s (extension_driver_session.dart:189-192), so a hung driver collects up to 12 concurrent getServerStats calls.
Samples land out of order. Postgres and MySQL append each result to the sparkline history (_recordHistory) on completion, so overlapping ticks reorder points.
Errors are invisible.catch (_) {} in every tick: no "stale since" state, no backoff, the dashboard silently freezes on the last good sample.
The timer is started from build() via syncTickerGatedPeriodicTimer (a side effect in build), and each view also keeps its own _startTimer.
Fix
One small PollingController (or mixin) in core/motion / core/util:
self-rescheduling: await tick() then schedule the next one, so at most one request is in flight;
gated by TickerMode (keep the current behaviour) and shouldRun;
exponential backoff on errors, last error + last success time exposed as a ValueListenable for a "stale" hint;
started and stopped from didChangeDependencies / dispose, not build.
Replace the five copies. Tests with a fake clock: a slow tick never overlaps; errors back off and recover; TickerMode off stops polling.
Activity