mirror of
https://github.com/Comfy-Org/comfy-python-sdk.git
synced 2026-11-04 23:37:47 +00:00
[PR #227] fix: close owned job event streams #227
Labels
No labels
audit:ai-readiness
audit:community
audit:github
audit:health-scoring
audit:policy
audit:release
audit:supply-chain
effort:medium
effort:small
effort:small
effort:trivial
priority:nice-to-have
priority:nice-to-have
priority:recommended
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-python-sdk#227
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-python-sdk/pull/227
Author: @allenflux
Created: 10/24/2026
Status: 🔄 Open
Base:
main← Head:codex/fix-event-stream-ownership📝 Commits (3)
2c75ecafix: close owned job event streamse6e724cchore: resolve event-stream PR changelog conflictb75126cfix: preserve iterator-only event transports📊 Changes
4 files changed (+292 additions, -16 deletions)
View changed files
📝
CHANGELOG.md(+5 -0)📝
src/comfy_sdk/jobs.py(+28 -16)➕
tests/test_event_iterator_overrides.py(+144 -0)➕
tests/test_event_stream_cleanup.py(+115 -0)📄 Description
Exhausting a job event iterator at a terminal frame, or explicitly closing it, does not currently close the low-level SSE generator it owns. That generator holds the HTTP response context across yields, so resource release can depend on generator finalization.
Close each owned stream with
closing/aclosinginside the existing per-connection error handling. Preserve polling fallback and reconnection behavior, and accurately annotate the low-level generator return types. This covers terminal exhaustion and explicit iterator closure; it does not promise automatic cleanup for an arbitrary barebreakwhile the caller retains the iterator.Validation on Python 3.12.11 / macOS arm64:
mypy srcpass. The public-repo hygiene check passes with the new test tracked.No live gateway or GPU was used. The cancellation case is a general control, not proof of cancellation during an active SSE read.
Summary by CodeRabbit
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.