-
Notifications
You must be signed in to change notification settings - Fork 61
RTL5l: detach immediately if disconnected and detach() called #2149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughModified RealtimeChannel.detach() to gracefully handle disconnected connection states by immediately notifying the channel as detached instead of throwing an error. Added test case RTL5l to validate this behavior when detaching during disconnected states. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
test/realtime/channel.test.js (1)
1655-1678: Well-structured test, but consider testing other non-connected states.The test correctly verifies the RTL5l behavior for the 'disconnected' state using modern async/await patterns and proper cleanup. However, the implementation at lines 406-410 in
realtimechannel.tshandles all non-connected states (connecting, disconnected, closing, closed, failed, suspended), not just 'disconnected'.Consider adding test cases for other connection states to ensure comprehensive coverage, particularly:
- 'connecting' (detach while connection is establishing)
- 'closing' (detach while connection is closing)
📜 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 (2)
src/common/lib/client/realtimechannel.tstest/realtime/channel.test.js
🧰 Additional context used
🧬 Code graph analysis (2)
test/realtime/channel.test.js (2)
test/realtime/init.test.js (1)
realtime(279-279)test/realtime/connection.test.js (1)
realtime(363-363)
src/common/lib/client/realtimechannel.ts (1)
src/common/lib/types/errorinfo.ts (1)
ErrorInfo(35-66)
⏰ 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). (7)
- GitHub Check: test-browser (chromium)
- GitHub Check: test-npm-package
- GitHub Check: test-browser (webkit)
- GitHub Check: test-browser (firefox)
- GitHub Check: test-node (20.x)
- GitHub Check: test-node (16.x)
- GitHub Check: test-node (18.x)
🔇 Additional comments (1)
src/common/lib/client/realtimechannel.ts (1)
406-410: RTL5l implementation is correct; the 'detaching' state is properly handled.The RTL5l check (lines 406-410) correctly handles non-connected states for channels not already in a terminal state. While channels already in 'detaching' bypass this check and go directly to the case at line 413, this is not an issue.
The
propogateConnectionInterruption()method inbaserealtime.tsexplicitly includes 'detaching' in itsfromChannelStatesarray (line 187), ensuring that when the connection transitions to closing, closed, failed, or suspended states, channels stuck in 'detaching' are properly transitioned to their corresponding channel states. This handles the edge case and prevents channels from remaining stuck in 'detaching' due to connection issues.
ably/specification#411
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.