Skip to content

Commit

Permalink
gracefull shutdown if python interpreter dies: #131
Browse files Browse the repository at this point in the history
  • Loading branch information
oliver-zehentleitner committed Nov 25, 2020
1 parent f43dd29 commit e3582fa
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,11 @@ def _create_stream_thread(self,
try:
loop.run_until_complete(socket.start_socket())
except RuntimeError as error_msg:
if "cannot schedule new futures after interpreter shutdown" in error_msg:
logging.critical(f"BinanceWebSocketApiManager._create_stream_thread() stream_id={str(stream_id)} "
f" - RuntimeError error_msg: - {str(error_msg)} - stopping and shutting down ...")
self.stop_manager_with_all_streams()
sys.exit(1)
logging.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: "
Expand Down

0 comments on commit e3582fa

Please sign in to comment.