[depthcache] Propagate exception to user instead of catching and silently failing #1578
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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