diff --git a/CHANGELOG.md b/CHANGELOG.md index 146cc11..44ac25b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p ## 1.36.0.dev (development stage/unreleased/unstable) ### Fixed - UnboundLocalError: local variable 'error_msg' referenced before assignment in sockets.py line 209 reported in [issue#235](https://github.com/LUCIT-Systems-and-Development/unicorn-binance-websocket-api/issues/235) +- Avoid error 2 of this post: https://github.com/LUCIT-Systems-and-Development/unicorn-binance-websocket-api/issues/131#issuecomment-1042747365 ## 1.36.0 ### Changed diff --git a/unicorn_binance_websocket_api/manager.py b/unicorn_binance_websocket_api/manager.py index da9894c..b44a8ec 100755 --- a/unicorn_binance_websocket_api/manager.py +++ b/unicorn_binance_websocket_api/manager.py @@ -484,8 +484,7 @@ def _create_stream_thread(self, self.stop_manager_with_all_streams() sys.exit(1) logger.critical(f"BinanceWebSocketApiManager._create_stream_thread() stream_id={str(stream_id)} " - f"error: 7 - {str(error_msg)} - if this stream did not restart after this error, please " - f"create an issue: " + f" - RuntimeError `error: 7` - error_msg: - {str(error_msg)} - Please create an issue: " f"https://github.com/LUCIT-Systems-and-Development/unicorn-binance-websocket-api/issues/new/choose") loop.close() finally: @@ -711,6 +710,9 @@ def _restart_stream(self, stream_id): self.stream_list[stream_id]['stream_buffer_maxlen'], True)) thread.start() + # Sleep to avoid error 2 of this post: + # https://github.com/LUCIT-Systems-and-Development/unicorn-binance-websocket-api/issues/131#issuecomment-1042747365 + time.sleep(0.3) return stream_id def _restart_stream_thread(self, stream_id): @@ -1213,6 +1215,9 @@ def create_stream(self, stream_buffer_maxlen, False)) thread.start() + # Sleep to avoid error 2 of this post: + # https://github.com/LUCIT-Systems-and-Development/unicorn-binance-websocket-api/issues/131#issuecomment-1042747365 + time.sleep(0.3) return stream_id def create_websocket_uri(self, channels, markets, stream_id=False, api_key=False, api_secret=False, symbols=False):