Don't add "None" callbacks to the queue

This commit is contained in:
Thomas Farstrike
2025-11-11 18:21:38 +01:00
parent 0e69359231
commit 00d5b181dd
+5 -3
View File
@@ -37,13 +37,15 @@ class WebSocketTimeoutException(WebSocketException):
_callback_queue = ucollections.deque((), 100) # Empty tuple, maxlen=100
def _run_callback(callback, *args):
if not callback:
print("_run_callback: skipping None callback")
return
"""Add callback to queue for execution."""
try:
_callback_queue.append((callback, args))
_log_debug(f"Queued callback {callback}, args={args}, queue size: {len(_callback_queue)}")
#if callback:
# print("Doing callback directly:")
# callback(*args)
# print("Doing callback directly:")
# callback(*args)
except IndexError:
_log_error("ERROR: websocket.py callback queue full, dropping callback")