-
Notifications
You must be signed in to change notification settings - Fork 27
fix: log connection state when unable to attach #653
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
base: main
Are you sure you want to change the base?
Conversation
WalkthroughA local variable Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 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 |
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)
ably/realtime/realtime_channel.py (1)
240-245: Consider applying the same fix to thedetach()method.Similar to the issue fixed in
attach(), this error message shows the channel state when the condition is actually checking the connection state. For consistency and clarity, consider updating this to show the connection state instead.Apply this diff to align with the fix in
attach():+ connection_state = self.__realtime.connection.state - if self.__realtime.connection.state in [ConnectionState.CLOSING, ConnectionState.FAILED]: + if connection_state in [ConnectionState.CLOSING, ConnectionState.FAILED]: raise AblyException( - message=f"Unable to detach; channel state = {self.state}", + message=f"Unable to detach channel; connection state = {connection_state}", code=90001, status_code=400 )
📜 Review details
Configuration used: CodeRabbit 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)
ably/realtime/realtime_channel.py(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
ably/realtime/realtime_channel.py (4)
ably/realtime/realtime.py (1)
connection(132-134)ably/realtime/connection.py (2)
state(109-111)state(120-121)ably/realtime/connectionmanager.py (1)
state(765-766)ably/types/connectionstate.py (1)
ConnectionState(8-16)
⏰ 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: check (3.14)
- GitHub Check: check (3.12)
- GitHub Check: check (3.13)
- GitHub Check: check (3.8)
- GitHub Check: check (3.9)
- GitHub Check: check (3.11)
- GitHub Check: check (3.10)
🔇 Additional comments (1)
ably/realtime/realtime_channel.py (1)
186-193: LGTM! Error message now correctly reflects the connection state.The changes properly address the issue where the error message was showing the channel state instead of the connection state that was actually preventing the attach. Caching the connection state also improves consistency and avoids multiple property accesses.
this log was unhelpfully printing the channel state when it's actually the connection state preventing the channel from attaching
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.