Skip to content

Commit

Permalink
fix(gateway): reconnect on protocol errors (#1159)
Browse files Browse the repository at this point in the history
  • Loading branch information
shiftinv authored Mar 24, 2024
1 parent 62dee68 commit ce8d276
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
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

0 comments on commit ce8d276

Please sign in to comment.