-
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?
Conversation
|
???还有人啊 |
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 attempts to fix a silent exit issue in the main process by modifying the reconnection handling logic in the wait() method. The changes restructure the flow to wrap the reconnect_task await in a try-except block and adjust the loop exit condition.
Key Changes
- Added exception handling around
reconnect_taskawaiting to prevent unhandled exceptions from propagating - Modified the loop exit condition to require both a non-connected state AND no active reconnect task
Comments suppressed due to low confidence (1)
botoy/_internal/client.py:231
- 'except' clause does nothing but pass and there is no explanatory comment.
except Exception:
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| except Exception: | ||
| pass |
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 bare except Exception: clause silently swallows all exceptions from the reconnect task. This makes debugging difficult and could hide important errors. Consider logging the exception before suppressing it, or at minimum catching more specific exceptions that are expected during reconnection attempts.
| except Exception: | |
| pass | |
| except Exception as e: | |
| logger.exception("Exception occurred while awaiting reconnect_task") |
| await self.reconnect_task | ||
| except Exception: | ||
| pass | ||
| if self.state != "connected" and not self.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: |
| break | ||
| await self.reconnect_task | ||
| if self.state != "connected": | ||
| if self.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 reconnect_task attribute is not initialized in the __init__ method. This means if the wait() method is called before any connection attempt that would set reconnect_task in _read_loop, line 228 will raise an AttributeError when checking if self.reconnect_task:. The attribute should be initialized to None in the constructor.
因为丢server里一直能run就没管 |
|
lemon哥,修复一下吧。大伙都在呢 |
#83