-
Notifications
You must be signed in to change notification settings - Fork 252
Reset keepalive state on reconnect #980
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 |
|---|---|---|
|
|
@@ -982,6 +982,14 @@ async def _force_disconnect(self) -> None: | |
| self._status = ClientStatus.CONNECTED | ||
| self._last_server = server | ||
|
|
||
| # Reset keepalive state so a reconnect caused by ping | ||
| # exhaustion doesn't inherit the stale counter and have | ||
| # the new write loop force-disconnect again one | ||
| # ping_interval later (mirrors initial-connect setup). | ||
| self._pings_outstanding = 0 | ||
| self._last_pong_received = asyncio.get_running_loop().time() | ||
| self._last_ping_sent = self._last_pong_received | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor inconsistency: |
||
|
|
||
| if new_server_info.connect_urls: | ||
| for url in new_server_info.connect_urls: | ||
| if url not in self._server_pool: | ||
|
|
||
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 comment is accurate and the bug it describes is non-obvious, so a comment is warranted. CLAUDE.md asks for one-line max though — something like
# Reset keepalive state; a ping-exhaustion reconnect must not inherit a stale counter.would capture the why without the four lines.