From 43f5e801f4f51bb8697727e986b7314afa6a6303 Mon Sep 17 00:00:00 2001 From: Git'Fellow <12234510+solracsf@users.noreply.github.com> Date: Fri, 21 Aug 2026 21:38:09 +0200 Subject: [PATCH 1/2] fix(user_status): stop the heartbeat firing on every mouse movement 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> --- apps/user_status/src/UserStatus.vue | 41 +----- .../src/services/heartbeatScheduler.spec.ts | 121 ++++++++++++++++++ .../src/services/heartbeatScheduler.ts | 53 ++++++++ 3 files changed, 181 insertions(+), 34 deletions(-) create mode 100644 apps/user_status/src/services/heartbeatScheduler.spec.ts create mode 100644 apps/user_status/src/services/heartbeatScheduler.ts diff --git a/apps/user_status/src/UserStatus.vue b/apps/user_status/src/UserStatus.vue index 52331c3373b72..789097407288d 100644 --- a/apps/user_status/src/UserStatus.vue +++ b/apps/user_status/src/UserStatus.vue @@ -40,13 +40,13 @@