Ensure generators are closed
Open
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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