Patient context
This commit is contained in:
@@ -24,6 +24,15 @@ from eb_dashboard_constants import CONFIG_FOLDER_NAME
|
||||
thread_local_storage = threading.local()
|
||||
|
||||
|
||||
def run_with_context(func, context, *args, **kwargs):
|
||||
"""
|
||||
Wrapper to set thread-local context before running a function in a new thread.
|
||||
Useful for ThreadPoolExecutor where context is lost.
|
||||
"""
|
||||
thread_local_storage.current_patient_context = context
|
||||
return func(*args, **kwargs)
|
||||
|
||||
|
||||
# These will be set/accessed from the main module
|
||||
httpx_clients = {}
|
||||
_clients_lock = threading.Lock()
|
||||
|
||||
Reference in New Issue
Block a user