Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closing a long running subscription - aclose() and GeneratorExit #752

Open
jonsmirl opened this issue Dec 22, 2021 · 2 comments
Open

Closing a long running subscription - aclose() and GeneratorExit #752

jonsmirl opened this issue Dec 22, 2021 · 2 comments
Labels
decision needed Sounds like good idea, but will need closer scrutiny for final decision.

Comments

@jonsmirl
Copy link

In asgi.py I can see the call to aclose();
await subscriptions[operation_id].aclose()

So how do I catch this in my subscription source? This should generate a GeneratorExit exception. I can not figure out a way to catch that exception in my subscription source which would then signal my code to exit.

@rafalp
Copy link
Contributor

rafalp commented Jan 12, 2022

I don't know if this is possible with how GraphQL's query executor is structured, as disconnection goes down and just removes async generators without telling them their job is done.

Do you mind sharing your usecase for explicit cleanup in source on disconnection?

@shyos

This comment was marked as off-topic.

@rafalp rafalp added question Further information is requested decision needed Sounds like good idea, but will need closer scrutiny for final decision. and removed question Further information is requested labels Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
decision needed Sounds like good idea, but will need closer scrutiny for final decision.
Projects
None yet
Development

No branches or pull requests

3 participants