From bfba7b0265852a711a3e94b66d30ab49eec3e2cd Mon Sep 17 00:00:00 2001 From: Sebastian Monroy Date: Thu, 16 Oct 2025 11:40:36 +0100 Subject: [PATCH] fix(nilor-nodes): prevent ComfyUI websocket 1009 disconnects by allowing large frames - Accept large preview frames from ComfyUI without dropping the socket. - Binary preview frames are still ignored by the consumer; this change stops the connection from closing with code 1009 (message too big). - Impact: keeps workers from getting stuck "busy" and allows long video job queues to finish reliably. Notes: - To reduce bandwidth instead of disabling client handling, start ComfyUI with --preview-method none or a smaller --preview-size. --- worker_consumer.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/worker_consumer.py b/worker_consumer.py index 46c7cfe..c559232 100644 --- a/worker_consumer.py +++ b/worker_consumer.py @@ -117,7 +117,15 @@ class WorkerConsumer: while True: try: ws_url = f"{COMFYUI_WS_URL}?clientId={urllib.parse.quote(self.worker_client_id)}" - async with websockets.connect(ws_url) as websocket: + # Allow large preview frames from ComfyUI without dropping the connection (1009: message too big) + async with websockets.connect( + ws_url, + max_size=None, # disable message size limit + read_limit=64 * 1024 * 1024, # buffer up to 64 MiB per frame + max_queue=4, # small queue to avoid memory spikes + ping_interval=20, + ping_timeout=20, + ) as websocket: logger.debug( f"ℹ️\u2009 Nilor-Nodes (worker_consumer): Connected to ComfyUI websocket at {ws_url}" )