Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /Saturn99X_Etherion /src /utils /tenant_context.py
| # src/utils/tenant_context.py | |
| from contextvars import ContextVar | |
| from typing import Optional | |
| # This ContextVar will hold the tenant_id for the current asynchronous context or thread. | |
| tenant_context: ContextVar[Optional[int]] = ContextVar('tenant_id', default=None) | |
| def get_tenant_context() -> Optional[int]: | |
| """Retrieves the tenant_id from the current context.""" | |
| return tenant_context.get() | |
| def set_tenant_context(tenant_id: Optional[int]) -> None: | |
| """Sets the tenant_id for the current context.""" | |
| tenant_context.set(tenant_id) |
Xet Storage Details
- Size:
- 548 Bytes
- Xet hash:
- cffa024fc32d8258765098c3081b6f21e08273f85c0baa84b80ec2918cb02bd4
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.