From 966024e5347f77baa2d2b352bc4df72f87c971ed Mon Sep 17 00:00:00 2001 From: Will Miao Date: Mon, 13 Jul 2026 19:10:48 +0800 Subject: [PATCH] fix(registry): force re-registration on WS refresh to prevent timeout, demote empty-registry log to debug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - workflow_registry.js: add force param to refreshRegistry(), bypass fingerprint dedup when responding to lora_registry_refresh WS message. Without this, the backend's wait_for_all() times out after 0.5s because the frontend skips the register-nodes POST when the workflow fingerprint hasn't changed (common after ComfyUI restart with an empty or unchanged workflow). - misc_handlers.py: demote 'No nodes registered after refresh' from WARNING to DEBUG — empty workflows are a normal operational state, not a warning-worthy condition. --- py/routes/handlers/misc_handlers.py | 5 ++++- web/comfyui/workflow_registry.js | 10 ++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/py/routes/handlers/misc_handlers.py b/py/routes/handlers/misc_handlers.py index 3325e4d4..63100897 100644 --- a/py/routes/handlers/misc_handlers.py +++ b/py/routes/handlers/misc_handlers.py @@ -3314,7 +3314,10 @@ class NodeRegistryHandler: self._last_slow_path_ts = time.monotonic() if registry_info["node_count"] == 0: - logger.warning("No nodes registered after refresh") + logger.debug( + "[LM:Registry] refresh OK — %s connected tab(s) but 0 compatible nodes found", + registry_info["tab_count"], + ) return web.json_response( { "success": False, diff --git a/web/comfyui/workflow_registry.js b/web/comfyui/workflow_registry.js index 947b0993..3549d74e 100644 --- a/web/comfyui/workflow_registry.js +++ b/web/comfyui/workflow_registry.js @@ -84,7 +84,7 @@ app.registerExtension({ this._log("extension initialized, clientId=%s", api.clientId ?? api.initialClientId ?? "(pending)"); api.addEventListener("lora_registry_refresh", () => { - this.refreshRegistry(); + this.refreshRegistry(true); }); api.addEventListener("lm_widget_update", (event) => { @@ -151,7 +151,7 @@ app.registerExtension({ console.debug(`[LM:Registry ${ts}] ${msg}`); }, - async refreshRegistry() { + async refreshRegistry(force = false) { try { const workflowNodes = []; const nodeEntries = getAllGraphNodes(app.graph); @@ -204,11 +204,13 @@ app.registerExtension({ const clientId = api.clientId ?? api.initialClientId ?? ""; - // Content-based dedup: skip POST if identical to last sent payload. + // Content-based dedup: skip POST if identical to last sent payload, + // unless forced (e.g. responding to a lora_registry_refresh WS message + // where the backend explicitly requests a re-registration). const fingerprint = JSON.stringify( workflowNodes.map(n => `${n.graph_id}:${n.node_id}|${n.marker_role ?? ""}|${n.mode ?? 0}`).sort() ); - if (fingerprint === this._lastFingerprint) { + if (!force && fingerprint === this._lastFingerprint) { return; } this._lastFingerprint = fingerprint;