Skip to content

Close the consumed subscription source iterator - #286

Merged
Cito merged 1 commit into
graphql-python:mainfrom
AryanRG:fix-close-subscription-iterator-283
Oct 19, 2026
Merged

Cito merged 1 commit into
graphql-python:mainfrom
AryanRG:fix-close-subscription-iterator-283

Conversation

@AryanRG

@AryanRG AryanRG commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Fixes #283.

Close the iterator returned by aiter(iterable), rather than the iterable wrapper, so subscription cleanup reaches the source actually being consumed.

Adds regression tests for explicit close, thrown errors and callback errors, plus a test through subscribe().

Validation: full suites on Python 3.10 and 3.14, required coverage, Ruff and mypy.

@codspeed

codspeed Bot commented Oct 19, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 20 untouched benchmarks


Comparing AryanRG:fix-close-subscription-iterator-283 (5d1ab0b) with main (d913a61)

Open in CodSpeed

@Cito Cito left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, this looks like the right way to fix it.

I would only change two minor things, but will do it after merging.

@Cito
Cito merged commit 6b0588f into graphql-python:main Oct 19, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Closing a subscription leaves a distinct source iterator open

2 participants