Skip to content

GUC-to-connection affinity guard for async contexts #41

@dvoraj75

Description

@dvoraj75

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions