Threading and Async Views

12 views
Skip to first unread message

Vasanth Mohan

unread,
Mar 7, 2023, 12:12:05 PM3/7/23
to Django users
Hello,

I'm currently building a multitenant service on django that uses a separate DB configuration per tenant. The frontend adds a unique header along with their requests so that the app can identify the tenant and select the DB to be used.

The catch is the tenant reference is stored as a thread local variable, so that the DatabaseRouter can use it.

However, I am currently looking up async views to see if it can help optimise our apis. Will my thread-based logic clash with the ASGI async views ?

Thanks
Vasanth M
Reply all
Reply to author
Forward
0 new messages