Benoit Chesneau 3bf718ea52 fix: graceful disconnect handling for ASGI worker
Closes #3484

When a client disconnects during an ASGI request, the worker now:
1. Sends http.disconnect message to the app's receive queue
2. Allows a configurable grace period for cleanup (default: 3 seconds)
3. Only cancels the task after the grace period expires

This follows the ASGI HTTP Connection Scope spec which defines
http.disconnect as the message apps should receive when clients
disconnect: https://asgi.readthedocs.io/en/latest/specs/www.html#disconnect-receive-event

The grace period prevents CancelledError from propagating to async
database operations, allowing SQLAlchemy and other async DB libraries
to properly reset their connection pools.

New config option: --asgi-disconnect-grace-period (default: 3 seconds)
2026-02-03 02:46:07 +01:00
..
2026-01-23 01:20:03 +01:00

Generate Documentation

Requirements

Install the documentation dependencies with:

pip install -r requirements_dev.txt

This provides MkDocs with the Material theme and supporting plugins.

Build static HTML

mkdocs build

The rendered site is emitted into the site/ directory.

Preview locally

mkdocs serve

This serves the documentation at http://127.0.0.1:8000/ with live reload.