Skip to content
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

fix(gateway): reconnect on protocol errors #1159

Merged
merged 3 commits into from
Mar 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/1159.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Reconnect gateway websocket on protocol errors.
3 changes: 2 additions & 1 deletion disnake/gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,8 @@ async def poll_event(self) -> None:
await self.received_message(msg.data)
elif msg.type is aiohttp.WSMsgType.ERROR:
_log.debug("Received %s", msg)
raise msg.data
# This is usually just an intermittent gateway hiccup, so try to reconnect again and resume
raise WebSocketClosure from msg.data
elif msg.type in (
aiohttp.WSMsgType.CLOSED,
aiohttp.WSMsgType.CLOSING,
Expand Down
Loading