-
Notifications
You must be signed in to change notification settings - Fork 18
Attempt to fix silent exit in main process #85
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -225,10 +225,12 @@ async def wait(self): | |||||||||
| break | ||||||||||
| await self.ws.wait_closed() | ||||||||||
| await asyncio.sleep(1) | ||||||||||
| if not self.reconnect_task: | ||||||||||
| break | ||||||||||
| await self.reconnect_task | ||||||||||
| if self.state != "connected": | ||||||||||
| if self.reconnect_task: | ||||||||||
| try: | ||||||||||
| await self.reconnect_task | ||||||||||
| except Exception: | ||||||||||
| pass | ||||||||||
|
Comment on lines
+231
to
+232
|
||||||||||
| except Exception: | |
| pass | |
| except Exception as e: | |
| logger.exception("Exception occurred while awaiting reconnect_task") |
Copilot
AI
Dec 16, 2025
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.
The exit condition logic has changed in a way that could cause premature exit. The original logic would break if reconnect_task was falsy OR if the state wasn't "connected". The new logic only breaks if BOTH conditions are true (state is not "connected" AND no reconnect_task). This means if the state is "disconnected" or "disconnecting" but somehow reconnect_task is truthy, the loop will continue indefinitely. Consider whether this behavior is intentional for the fix.
| if self.state != "connected" and not self.reconnect_task: | |
| if self.state != "connected" or not self.reconnect_task: |
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.
The
reconnect_taskattribute is not initialized in the__init__method. This means if thewait()method is called before any connection attempt that would setreconnect_taskin_read_loop, line 228 will raise anAttributeErrorwhen checkingif self.reconnect_task:. The attribute should be initialized toNonein the constructor.