Repository navigation
fix(comfyui): short connect timeout for loopback health probes - #934
Open
AdvaithSai wants to merge 1 commit into
Open
AdvaithSai wants to merge 1 commit into
AdvaithSai wants to merge 1 commit into
Conversation
On Windows a connect to a closed port is retried for ~2s per address instead of failing at once, and localhost resolves to both ::1 and 127.0.0.1. With no ComfyUI server running, every is_available() probe cost ~4s, and the registry probes it once per ComfyUI tool and selector, so preflight spent ~20s waiting on a server that isn't there. A local server completes the TCP handshake in well under a millisecond, so use a 0.5s connect timeout for loopback hosts. Remote servers and the read timeout keep 5s. Preflight on Windows drops from ~42s to ~19s. Refs OpenMontageInc#756
AdvaithSai
force-pushed
the
fix/windows-onboarding
branch
from
November 10, 2026 08:49
d41cf03 to
220e480
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On Windows, a connection to a closed port is retried for about 2s per address instead of failing at once, and
localhostresolves to both::1and127.0.0.1. So with no ComfyUI server running (the default for most users), eachComfyUIClient.is_available()probe takes about 4s. The registry probes once for each ofcomfyui_image,comfyui_videoandcomfyui_music, plus once each forimage_selectorandvideo_selector, so preflight spends about 20s waiting for a server that isn't there.A server on the same machine completes the TCP handshake in well under a millisecond, so the health probe now uses a 0.5s connect timeout for loopback hosts (
localhost,127.0.0.0/8,::1). Remote ComfyUI servers keep the 5s connect timeout, and the read timeout stays at 5s everywhere, so a busy local server that is slow to answer/system_statsis still detected.Related issue
Refs #756 (one part of the "too slow" complaint; the docs and permission parts of that issue are not addressed here)
Changes
tools/_comfyui/client.py: new_probe_timeout()that returns(0.5, 5)for loopback hosts and(5, 5)otherwise;is_available()uses it.tests/contracts/test_comfyui_tools.py: parametrized test covering localhost, 127.0.0.1,[::1], a LAN IP and a remote hostname.Testing
Windows 11, Python 3.12, no ComfyUI running:
ComfyUIClient("http://localhost:8188").is_available()get_status()callsregistry.provider_menu()(preflight)127.0.0.1:8188returning 200 is still detected (0.52s vialocalhost, 0.02s via127.0.0.1).pytest tests/contracts/test_comfyui_tools.py tests/tools/test_new_video_model_support.py tests/tools/test_provider_refresh.py→ 184 passed.Checklist
make test-contracts/make test) where applicable.