mirror of
https://github.com/Comfy-Org/comfy-swift-sdk.git
synced 2026-11-04 23:47:26 +00:00
[PR #29] [MERGED] refactor(transport): unify the two fixed-schedule transient retriers #33
Labels
No labels
enhancement
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Comfy-Org/comfy-swift-sdk#33
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Comfy-Org/comfy-swift-sdk/pull/29
Author: @mattmillerai
Created: 7/4/2026
Status: ✅ Merged
Merged: 7/5/2026
Merged by: @mattmillerai
Base:
main← Head:matt/be-2353-consolidate-transient-retriers📝 Commits (3)
51bdb3brefactor(transport): unify the two fixed-schedule transient retriersc54f85afix(transport): propagate cancellation during output-retrier delaybd8e783Merge remote-tracking branch 'origin/main' into matt/be-2353-consolidate-transient-retriers📊 Changes
2 files changed (+44 additions, -15 deletions)
View changed files
📝
Sources/ComfySwiftSDK/Internal/PollingFallback.swift(+34 -4)📝
Sources/ComfySwiftSDK/Internal/ReattachCoordinator.swift(+10 -11)📄 Description
ELI-5
We had two little "try again if the network hiccups" loops that looked almost the same: one for downloading a job's output files, one for the reattach catch-up status fetch. Both try 3 times and give up. They only really differed in how long they waited between tries. This PR replaces the two copy-pasted loops with a single shared helper and just hands each caller its own wait-schedule, so the exact timing each one had before is unchanged.
What changed
PollingFallback.withTransientRetry(delays:sleep:body:):retries transient
ComfyErrors, attempt budget =delays.count + 1, non-transienterrors propagate immediately, last transient error rethrown once exhausted.
its exact prior timing:
assembleOutput→withTransientRetry(body:)):[250ms, .zero],sleeping on
Task(real clock). The conveniencewithTransientRetry(body:)overload iskept so the existing call sites and tests are untouched;
outputFetchMaxAttemptsnowderives from the schedule.
ReattachCoordinator.fetchJobStatusWithTransientRetry):[250ms, 750ms], sleeping on the test-injectableClock..zeropad) advances the attempt budget without a sleep,so the output retrier's original "no pause before the 3rd attempt" is preserved exactly —
no phantom zero-length suspension.
Explicitly out of scope
The poll loop's steady-state backoff ladder (
backoffLadder2/4/8s) is not merged intothis helper. It is a polling-cadence concern, not bounded error recovery, and consolidating
it would conflate two different behaviors. Left untouched.
Judgment calls
Output fetch transient retry,Reattach transient-retry, andReattachCoordinatorsuites, all green (full suite: 150 tests / 20 suites pass).
outputFetchMaxAttemptschanged from a storedlet 3to a computed property derived fromthe schedule length, to keep a single source of truth. Value is still
3; it staysinternaland the test that reads it is unaffected.Testing
swift buildclean;swift test --no-parallel→ 150 tests in 20 suites passed.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.