improve exception handling

This commit is contained in:
Thomas Farstrike
2025-05-21 12:27:02 +02:00
parent 57814037d3
commit 4d9f5ab83f
3 changed files with 14 additions and 6 deletions
+1
View File
@@ -17,6 +17,7 @@ class Thread:
#_thread.stack_size(10*1024) # might not be enough
#stacksize = 12*1024
# small stack sizes 8KB gives segfault directly
# 22KB or less is too tight on desktop, 23KB and more is fine
stacksize = 24*1024
print(f"starting thread with stacksize {stacksize}")
_thread.stack_size(stacksize)
+8 -4
View File
@@ -230,9 +230,10 @@ class WebSocketApp:
self.close()
return False
except Exception as e:
_log_error(f"run_forever got general exception: {e}")
_log_error(f"run_forever's _loop.run_until_complete() got general exception: {e}")
self.has_errored = True
return True
self.running = False
#return True
_log_debug("run_forever completed")
return self.has_errored
@@ -250,8 +251,11 @@ class WebSocketApp:
_log_debug(f"Reconnect interval set to {reconnect}s")
# Start callback processing task
callback_task = asyncio.create_task(_process_callbacks_async())
_log_debug("Started callback processing task")
try:
callback_task = asyncio.create_task(_process_callbacks_async())
_log_debug("Started callback processing task")
except Exception as e:
print(f"websocket.py: create_ask(_process_callbacks_async()) had exception {e}")
while self.running:
_log_debug("Main loop iteration: self.running=True")