regression: fix presence connections not being updated in DDPStreamer#37855
regression: fix presence connections not being updated in DDPStreamer#37855kodiakhq[bot] merged 5 commits intodevelopfrom
Conversation
|
Looks like this PR is ready to merge! 🎉 |
|
WalkthroughReplaces heartbeat/_seenPacket-based presence coordination with a throttled presence-update approach: incoming messages now invoke a throttled updater that calls the presence update when a userId exists; immediate presence-on-heartbeat and packet-tracking fields were removed, and presence-update errors are logged. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #37855 +/- ##
========================================
Coverage 67.75% 67.75%
========================================
Files 3463 3463
Lines 113702 113702
Branches 20901 20901
========================================
+ Hits 77034 77038 +4
+ Misses 34501 34494 -7
- Partials 2167 2170 +3
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
sampaiodiego
left a comment
There was a problem hiding this comment.
instead of all this sheninagans with intervals and flags all around, pls change the implementation to a throttle to call Presence.updateConnection
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
ee/apps/ddp-streamer/src/Client.ts (1)
78-88: Consider using structured logging instead of console.error.The throttled presence update implementation looks correct, with appropriate throttle options for periodic updates. However, the error handling uses
console.errorwhich may not integrate with the application's logging system.If the codebase has a structured logging service or logger, consider using it instead of
console.errorfor consistency:- void Presence.updateConnection(this.userId, this.connection.id).catch((err) => { - console.error('Error updating connection presence:', err); - }); + void Presence.updateConnection(this.userId, this.connection.id).catch((err) => { + logger.error('Error updating connection presence:', err); + });
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Jira integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
ee/apps/ddp-streamer/src/Client.ts(3 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation
Files:
ee/apps/ddp-streamer/src/Client.ts
🧬 Code graph analysis (1)
ee/apps/ddp-streamer/src/Client.ts (1)
ee/packages/presence/src/Presence.ts (1)
Presence(12-334)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: 📦 Build Packages
- GitHub Check: CodeQL-Build
- GitHub Check: CodeQL-Build
🔇 Additional comments (1)
ee/apps/ddp-streamer/src/Client.ts (1)
217-217: LGTM! Throttled presence update integration is correct.The placement of
this.updatePresence()on every incoming message, combined with the throttle mechanism, ensures that active connections have their presence periodically refreshed without overwhelming the presence service. The throttle'sleading: trueconfiguration guarantees that the first message after each throttle period triggers an immediate update, which aligns with the PR objective of preventing active users from being marked offline.
|
/bark |
|
/patch |
|
Pull request #37887 added to Project: "Patch 7.13.2" |
|
/backport 7.12.3 |
|
/backport 7.11.3 |
|
/backport 7.10.6 |
|
Pull request #37888 added to Project: "Patch 7.12.3" |
|
Pull request #37889 added to Project: "Patch 7.11.3" |
|
Pull request #37890 added to Project: "Patch 7.10.6" |
Regression from #37551
Proposed changes (including videos or screenshots)
Clientpresence update mechanism to use a throttle-based approach instead of interval-based heartbeat with flag tracking:_seenPacketflag andheartbeatIntervallogic with a throttledupdatePresencemethodunderscore'sthrottleutility with{ leading: true, trailing: false }to ensure presence updates occur at most once perTIMEOUT(30 seconds)UsersSessions.connections._updatedAtis periodically refreshed for active DDPStreamer connections, preventing the PresenceReaper from incorrectly pruning them as stale.Issue(s)
Fixes https://rocketchat.atlassian.net/browse/CORE-1568
Steps to test or reproduce
usersSessionsand observe theirconnectionsarray:connections._updatedAtstops changing after the initial login.connections._updatedAtis bumped at most once per 30 seconds while the user is active.Further comments
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.