Skip to content

Commit 92ac665

Browse files
committed
try to reconect on some exceptions
1 parent d18981e commit 92ac665

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

binance/ws/reconnecting_websocket.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
pass
1616

1717
try:
18-
from websockets.exceptions import ConnectionClosedError # type: ignore
18+
from websockets.exceptions import ConnectionClosedError, ConnectionClosedOK # type: ignore
1919
except ImportError:
20-
from websockets import ConnectionClosedError # type: ignore
20+
from websockets import ConnectionClosedError, ConnectionClosedOK # type: ignore
2121

2222

2323
Proxy = None
@@ -226,7 +226,9 @@ async def _read_loop(self):
226226
asyncio.IncompleteReadError,
227227
gaierror,
228228
ConnectionClosedError,
229+
ConnectionClosedOK,
229230
BinanceWebsocketClosed,
231+
BinanceWebsocketUnableToConnect,
230232
) as e:
231233
# reports errors and continue loop
232234
self._log.error(f"{e.__class__.__name__} ({e})")
@@ -236,7 +238,6 @@ async def _read_loop(self):
236238
"m": f"{e}",
237239
})
238240
except (
239-
BinanceWebsocketUnableToConnect,
240241
BinanceWebsocketQueueOverflow,
241242
Exception,
242243
) as e:

0 commit comments

Comments
 (0)