Skip to content

fix(perf): preserve online time when foreground checkpoint timer is delayed - #472

Draft
hoangsvit wants to merge 2 commits into
stagingfrom
fix/online-presence-delayed-checkpoint-20261110
Draft

hoangsvit wants to merge 2 commits into
stagingfrom
fix/online-presence-delayed-checkpoint-20261110

Conversation

@hoangsvit

Copy link
Copy Markdown
Member

Reproduction / impact

createOnlineDurationTracker caps a single unflushed interval at 15s. If a foreground timer is delayed, user interaction at 15s previously only updated lastActivityAt, without flushing. Stopping at 20s then records 15s instead of 20s, despite explicit activity at 15s. This is an independently testable foreground timing edge case relevant to #328.

Change

On user activity, flush an active interval if it reached MAX_ONLINE_CHECKPOINT_MS, before resetting the idle deadline. Preserve existing handling for activity after idle and cap long timer gaps. No extra writes for interactions shorter than the checkpoint threshold.

Regression

Added foreground activity checkpoints a delayed timer before later time is lost expecting [15000, 5000] for activity at 15s and stop at 20s. The old implementation yields [15000] (single capped interval). Full npm test, Node execution, CI and browser tests have not yet been run/verified.

Risk / acceptance

Low: may add one persistence write on foreground input after a delayed >=15s timer; does not affect audio playback. Accept when npm test and CI pass, and both idle-gap safety and delayed foreground activity regressions pass. No merge/deploy requested.

@coderabbitai

coderabbitai Bot commented Nov 10, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

ePlus OnAir — PR Preview

✅ Preview ready for commit d8f8ce5 (public SHA and noindex verified).

Open preview · View build status

Static preview: representative routes only; full catalog remains on Staging after merge. Noindex and production GA4 disabled.

This branch was successfully deployed

1 active deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant