mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-05-29 17:19:36 +02:00
* Fix airtable connector w/ mt cloud + move telem logic to match new standard * Address Greptile comment * Small fixes/improvements * Revert back monitoring frequency * Small monitoring fix
19 lines
490 B
Python
19 lines
490 B
Python
import contextvars
|
|
|
|
from shared_configs.configs import POSTGRES_DEFAULT_SCHEMA
|
|
|
|
# Context variable for the current tenant id
|
|
CURRENT_TENANT_ID_CONTEXTVAR = contextvars.ContextVar(
|
|
"current_tenant_id", default=POSTGRES_DEFAULT_SCHEMA
|
|
)
|
|
|
|
|
|
"""Utils related to contextvars"""
|
|
|
|
|
|
def get_current_tenant_id() -> str:
|
|
tenant_id = CURRENT_TENANT_ID_CONTEXTVAR.get()
|
|
if tenant_id is None:
|
|
raise RuntimeError("Tenant ID is not set. This should never happen.")
|
|
return tenant_id
|