Skip to content

[stable35] fix(user_status): one heartbeat per interval, and refresh before invalidation - #64136

Merged
susnux merged 3 commits into
stable35from
backport/63746/stable35
Sep 9, 2026
Merged

[stable35] fix(user_status): one heartbeat per interval, and refresh before invalidation#64136
susnux merged 3 commits into
stable35from
backport/63746/stable35

Conversation

@backportbot

@backportbot backportbot Bot commented Sep 9, 2026

Copy link
Copy Markdown

Backport of PR #63746

The away countdown was cancelled by passing the callback function to
clearTimeout() instead of the id returned by setTimeout(), so the clear
did nothing and the id was thrown away. Every burst of mouse movement
scheduled another two minute timer that nothing could cancel, and each
one that expired marked an active user as away. The next movement
flipped them back and sent a heartbeat, so an ordinary browsing session
sent around 600 heartbeats an hour instead of the 13 the code intends.

The scheduling now lives in its own module, which makes it testable
without mounting the component and gives the timers a single owner. That
also fixes the teardown: the listener was registered as "mousemove" with
capture and removed as "mouseMove" without it, so it was never actually
removed and every unmounted component leaked one.

Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
UserLiveStatusListener only refreshed status_timestamp once it was
already older than INVALIDATE_STATUS_THRESHOLD, which is the same 15
minutes at which ClearOldStatusesBackgroundJob sweeps a status to
offline. With a five minute client interval that leaves a window, up to
one interval wide, in which a user who never stopped working is shown as
offline until their next heartbeat arrives.

The refresh now happens at REFRESH_STATUS_THRESHOLD, far enough below
the invalidation threshold to leave room for a full heartbeat interval.
Until now the sheer number of heartbeats hid the problem, because one
always landed within seconds of the cleanup job.

Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
@pringelmann

Copy link
Copy Markdown
Contributor

/compile

Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
@susnux
susnux merged commit 8549068 into stable35 Sep 9, 2026
207 of 218 checks passed
@susnux
susnux deleted the backport/63746/stable35 branch September 9, 2026 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants