[stable35] fix(user_status): one heartbeat per interval, and refresh before invalidation - #64136
Merged
Conversation
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>
backportbot
Bot
requested review from
artonge,
icewind1991,
kristian-zendato,
leftybournes,
pringelmann,
provokateurin,
skjnldsv,
solracsf,
sorbaugh and
susnux
and removed request for
a team
September 9, 2026 08:19
artonge
approved these changes
Sep 9, 2026
pringelmann
approved these changes
Sep 9, 2026
Contributor
|
/compile |
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of PR #63746