_ReadReplicaRouterStorage is a thread local, and may need to be replaced with a contextvar to make things async-friendly. It's possible that built-in Django functionality now exists to do the same thing, and we can replace this altogether.
|
class _ReadReplicaRouterStorage(threading.local): |
|
def __init__(self): |
|
super().__init__() |
|
self.db_name = None |
|
|
|
|
|
_storage = _ReadReplicaRouterStorage() |
_ReadReplicaRouterStorage is a thread local, and may need to be replaced with a contextvar to make things async-friendly. It's possible that built-in Django functionality now exists to do the same thing, and we can replace this altogether.
edx-django-utils/edx_django_utils/db/read_replica.py
Lines 107 to 113 in fe75e97