pallets / pallets/quart

Ensure generators are closed

Open
#218 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
3.7k
Forks
206
PR merge metrics
No merged PRs in 30d

Description

import asyncio
from quart import Quart, Response

app = Quart(__name__)

@app.route('/')
async def sub():
        response = Response(
            data_stream(),
            mimetype="text/event-stream",
        )
        response.timeout = None
        return response

async def data_stream():
    try:
        while True:
            print("Sending Data")
            if False:
                yield "data: {ok: true}\n\n"
            await asyncio.sleep(1)
    finally:
        print("Exited Gen")
    
app.run()

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the provided Quart streaming-response reproduction and trace how the async generator is handled when the response ends or the client disconnects. Identify the response and generator-cleanup entry points, then verify the generator's finally block runs reliably; the issue provides no file or test names.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.