Description
Ensure that when GUCs are set in one thread/context, queries that execute on a different connection (due to sync_to_async thread-hops) either inherit the GUC state or raise a clear error.
Extend the existing connection_created signal handler to cover async connection acquisition patterns.
Tier 5 — depends on Tiers 1-3.
Why
In async Django, django.db.connections is thread-local. A sync_to_async hop lands on a new thread with a fresh connection that does not have the GUC set. The existing connection_created signal handler partially covers lazily-created connections, but does not cover reused connections from a different request's thread.
Roadmap reference
v1.4.0 — Async Support
Description
Ensure that when GUCs are set in one thread/context, queries that execute on a different connection (due to
sync_to_asyncthread-hops) either inherit the GUC state or raise a clear error.Extend the existing
connection_createdsignal handler to cover async connection acquisition patterns.Tier 5 — depends on Tiers 1-3.
Why
In async Django,
django.db.connectionsis thread-local. Async_to_asynchop lands on a new thread with a fresh connection that does not have the GUC set. The existingconnection_createdsignal handler partially covers lazily-created connections, but does not cover reused connections from a different request's thread.Roadmap reference
v1.4.0 — Async Support