Skip to content

🐛(backend) stream document content with an async iterator under ASGI#2381

Merged
lunika merged 1 commit into
mainfrom
fix/async-generator
Jun 4, 2026
Merged

🐛(backend) stream document content with an async iterator under ASGI#2381
lunika merged 1 commit into
mainfrom
fix/async-generator

Conversation

@lunika
Copy link
Copy Markdown
Member

@lunika lunika commented Jun 2, 2026

Purpose

When docs is ran using an ASGI server, the django StreamingHttpResponse expect to consume an async generator. If a sync generator is used, it fully consumes it and then return all the content and we loose the benefits of using a StreamingHttpResponse.

It fixes this warning :

/app/.venv/lib/python3.13/site-packages/django/core/handlers/asgi.py:336: Warning: StreamingHttpResponse must consume synchronous iterators in order to serve them asynchronously. Use an asynchronous iterator instead.

Proposal

  • 🐛(backend) stream document content with an async iterator under ASGI

@lunika lunika requested a review from qbey June 2, 2026 15:27
@lunika lunika self-assigned this Jun 2, 2026
@lunika lunika added the backend label Jun 2, 2026
@lunika lunika force-pushed the fix/async-generator branch from dcde2a9 to 86d215b Compare June 3, 2026 14:09
@lunika lunika force-pushed the fix/async-generator branch from 86d215b to d53d915 Compare June 4, 2026 14:43
@lunika lunika enabled auto-merge (squash) June 4, 2026 14:44
When docs is ran using an ASGI server, the django StreamingHttpResponse
expect to consume an async generator. If a sync generator is used, it
fully consumes it and then return all the content and we loose the
benefits of using a StreamingHttpResponse.
@lunika lunika force-pushed the fix/async-generator branch from d53d915 to 8fe6844 Compare June 4, 2026 15:21
@lunika lunika merged commit 26670eb into main Jun 4, 2026
43 checks passed
@lunika lunika deleted the fix/async-generator branch June 4, 2026 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants