feat: make API node retry parameters configurable via environment variables#13475
Closed
christian-byrne wants to merge 1 commit intomasterfrom
Closed
feat: make API node retry parameters configurable via environment variables#13475christian-byrne wants to merge 1 commit intomasterfrom
christian-byrne wants to merge 1 commit intomasterfrom
Conversation
…iables Adds COMFY_API_MAX_RETRIES, COMFY_API_RETRY_DELAY, and COMFY_API_RETRY_BACKOFF environment variables that override the default retry parameters for all API node HTTP requests (sync_op, sync_op_raw, upload_file, download_url_to_bytesio). Users in regions with unstable networks (e.g. behind the GFW in China) can increase the retry budget to tolerate longer network interruptions: COMFY_API_MAX_RETRIES=10 COMFY_API_RETRY_DELAY=2.0 python main.py Defaults remain unchanged (3 retries, 1.0s delay, 2.0x backoff) when the env vars are not set.
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.
PR Created by the Glary-Bot Agent
Summary
COMFY_API_MAX_RETRIES,COMFY_API_RETRY_DELAY, andCOMFY_API_RETRY_BACKOFFenvironment variables to override default retry parameters for all API node HTTP requestsContext
Users in China experience
LocalNetworkErrorfailures because the default retry budget of 3 retries (~7s total) is insufficient for networks with intermittent connectivity. This change lets affected users self-mitigate by increasing retries:Changes
comfy_api_nodes/util/client.py:_env_int()/_env_float()helpers that read env vars with fallback defaults_RetryDefaultsdataclass andRETRY_DEFAULTSsingletonRETRY_DEFAULTSintosync_op,sync_op_rawdefault parameterscomfy_api_nodes/util/download_helpers.py:RETRY_DEFAULTSintodownload_url_to_bytesiodefaults (withmax(5, RETRY_DEFAULTS.max_retries)floor)comfy_api_nodes/util/upload_helpers.py:RETRY_DEFAULTSintoupload_filedefaultstests/test_retry_defaults.py— 10 tests:_env_int/_env_float: default, override, invalid value handling_RetryDefaults: hardcoded defaults, env override mechanism, explicit construction, frozen immutabilityVerification
Backend Python utility — no browser testing applicable. All 10 unit tests pass. No new LSP diagnostics.
API Node PR Checklist
Scope
Pricing & Billing
If Need pricing update:
QA
Comms