Skip to content

Async-native RLSTenantMiddleware — add __acall__ support #38

@dvoraj75

Description

@dvoraj75

Description

Add __acall__ (or the Django 4.1+ async middleware pattern) to RLSTenantMiddleware so it runs natively in the ASGI event loop without sync_to_async thread-hops. Uses aset_guc() / aclear_guc() for GUC operations.

Tier 3 — depends on Tier 1 (async GUC primitives).

Must remain backward-compatible — sync WSGI deployments must continue working identically.

Why

The current MiddlewareMixin-based middleware works under ASGI but forces a sync-to-async thread-hop per request. For high-concurrency ASGI deployments, this adds latency and limits throughput. A native async path eliminates the thread-pool bottleneck.

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