[depthcache] Propagate exception to user instead of catching and silently failing#1578
[depthcache] Propagate exception to user instead of catching and silently failing#1578ahorn639 wants to merge 1 commit intosammchardy:masterfrom
Conversation
|
@ahorn639 Thanks for your contribution, we will review it and merge it shortly. |
|
yeah.. I've had a similar question for the reconnects, but I'm not sure this is the right approach I think here the correct behavior should be:
I believe this way the depthManager would follow the same logic as a regular websocket connection of the library. I'll work on a PR to fix this |
Thanks @pcriadoperez ! Will give it a go, fix looks good |
This error occurs frequently whilst using the DepthCacheManager
2025-04-14 01:06:23.479 binance.ws.reconnecting_websocket ERROR [MainThread] [_read_loop] BinanceWebsocketClosed (Connection closed. Reconnecting...)The code takes too long to reconnect and in that time the message queue fills up and you get an BinanceWebsocketQueueOverflow exception
2025-04-14 01:07:02.926 binance.ws.reconnecting_websocket ERROR [MainThread] [_read_loop] Unknown exception (Message queue size 100 exceeded maximum 100)All exceptions are caught internally by the library so the user can't automatically reconnect (this should really be fixed in the ReconnectingWebsocket but I don't know enough about all the various use cases to comment.
Instead, what happens is this repeatedly
2025-04-14 01:08:07.641 binance.ws.depthcache WARNING [MainThread] [recv]2025-04-14 01:08:07.641 binance.ws.depthcache WARNING [MainThread] [recv]2025-04-14 01:08:07.641 binance.ws.depthcache WARNING [MainThread] [recv]2025-04-14 01:08:07.641 binance.ws.depthcache WARNING [MainThread] [recv]...
This change just propagates the exception while reading off the queue to the user so that they can reconnect themselves