-
Notifications
You must be signed in to change notification settings - Fork 212
fix: debounce for ensurePublisherConnected. #967
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
fix: debounce for ensurePublisherConnected. #967
Conversation
📝 WalkthroughWalkthroughAdds a cached in-progress publisher connection Future and a new internal Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 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)
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
⏰ 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)
🔇 Additional comments (6)
✏️ Tip: You can disable this entire section by setting 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: 2
🤖 Fix all issues with AI agents
In `@lib/src/core/engine.dart`:
- Around line 506-510: ensurePublisherConnected currently caches the future in
_publisherConnectionFuture but never clears it if _publisherEnsureConnected()
throws or times out, causing permanent failure; modify ensurePublisherConnected
to assign _publisherConnectionFuture = _publisherEnsureConnected() as now, then
await it inside a try/catch, and in the catch block reset
_publisherConnectionFuture to null before rethrowing the error so subsequent
calls can retry; reference functions/fields: ensurePublisherConnected,
_publisherConnectionFuture, and _publisherEnsureConnected.
- Around line 1148-1150: Cached publisher connection future
_publisherConnectionFuture can remain completed after restartConnection()
causing ensurePublisherConnected() to skip renegotiation; when
disposing/recreating the publisher inside restartConnection() clear/reset
_publisherConnectionFuture (set to null or a fresh completer) so
ensurePublisherConnected() will recreate the connection for the new publisher
instance; update restartConnection() teardown path where the old publisher is
disposed to reset _publisherConnectionFuture before new publisher creation.
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
lib/src/core/engine.dart
⏰ 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: Build for Flutter Android
- GitHub Check: Build for Flutter Web WASM
- GitHub Check: Build for Flutter Linux
- GitHub Check: Build for Flutter Windows
- GitHub Check: Build for Flutter macOS
- GitHub Check: Build for Flutter iOS
- GitHub Check: Build for Flutter Web
🔇 Additional comments (3)
lib/src/core/engine.dart (3)
168-168: LGTM: cached in-flight publisher connection state.The field addition is clear and well-scoped for debouncing.
411-423: LGTM: avoid sending before publisher is connected.Good guard to ensure the publisher transport is ready when subscriber is primary.
643-650: LGTM: cache reset on disconnected/failed/closed states.This keeps the memoized future aligned with connection lifecycle.
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
xianshijing-lk
left a 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.
please address the ai bot comments, I found it pretty useful.
Summary by CodeRabbit