-
Notifications
You must be signed in to change notification settings - Fork 0
Allow for correctly reconnecting after initial connect() is interrupted
#34
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
PR checklist ✅All required conditions are satisfied:
🎉 Great job! This PR is ready for review. |
1 similar comment
PR checklist ✅All required conditions are satisfied:
🎉 Great job! This PR is ready for review. |
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.
Pull request overview
This PR fixes an edge case in the reconnection logic where the app backgrounds during an ongoing initial connect() call. The fix ensures that when a Recovery.Disconnect is triggered (e.g., when backgrounding), any in-flight connection attempt is properly canceled before disconnecting.
Key changes:
- Enhanced
recoveryEffect()to cancel pending connect operations when disconnecting - Reordered monitor startup to occur before token loading in
connect() - Added comprehensive test coverage for background/foreground transitions during connection attempts
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
StreamClientImpl.kt |
Updated recoveryEffect() to cancel in-flight connects and properly update state; reordered network monitor startup |
StreamClientIImplTest.kt |
Added three new tests and helper classes to verify reconnection edge cases during lifecycle transitions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
stream-android-core/src/main/java/io/getstream/android/core/internal/client/StreamClientImpl.kt
Outdated
Show resolved
Hide resolved
stream-android-core/src/main/java/io/getstream/android/core/internal/client/StreamClientImpl.kt
Outdated
Show resolved
Hide resolved
stream-android-core/src/main/java/io/getstream/android/core/internal/client/StreamClientImpl.kt
Outdated
Show resolved
Hide resolved
|
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.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.



Goal
Fix and edge case where reconnect would need to happen after disconnect in the background while the initial connect is running.
Implementation
Correctly update the state in
recoveryEffectinStreamClientImplTesting
Added two new unit tests for these scenarios.
Checklist