mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-06-24 15:00:57 +02:00
improve
This commit is contained in:
parent
ae585fd84c
commit
fdfd8bc16e
@ -104,14 +104,14 @@ async def provision_tenant(tenant_id: str, email: str) -> None:
|
|||||||
status_code=409, detail="User already belongs to an organization"
|
status_code=409, detail="User already belongs to an organization"
|
||||||
)
|
)
|
||||||
|
|
||||||
logger.info(f"Provisioning tenant: {tenant_id}")
|
logger.debug(f"Provisioning tenant {tenant_id} for user {email}")
|
||||||
token = None
|
token = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if not create_schema_if_not_exists(tenant_id):
|
if not create_schema_if_not_exists(tenant_id):
|
||||||
logger.info(f"Created schema for tenant {tenant_id}")
|
logger.debug(f"Created schema for tenant {tenant_id}")
|
||||||
else:
|
else:
|
||||||
logger.info(f"Schema already exists for tenant {tenant_id}")
|
logger.debug(f"Schema already exists for tenant {tenant_id}")
|
||||||
|
|
||||||
token = CURRENT_TENANT_ID_CONTEXTVAR.set(tenant_id)
|
token = CURRENT_TENANT_ID_CONTEXTVAR.set(tenant_id)
|
||||||
|
|
||||||
|
@ -523,6 +523,7 @@ class UserManager(UUIDIDMixin, BaseUserManager[User, uuid.UUID]):
|
|||||||
token = CURRENT_TENANT_ID_CONTEXTVAR.set(tenant_id)
|
token = CURRENT_TENANT_ID_CONTEXTVAR.set(tenant_id)
|
||||||
try:
|
try:
|
||||||
user_count = await get_user_count()
|
user_count = await get_user_count()
|
||||||
|
logger.debug(f"Current tenant user count: {user_count}")
|
||||||
|
|
||||||
with get_session_with_tenant(tenant_id=tenant_id) as db_session:
|
with get_session_with_tenant(tenant_id=tenant_id) as db_session:
|
||||||
if user_count == 1:
|
if user_count == 1:
|
||||||
@ -544,7 +545,7 @@ class UserManager(UUIDIDMixin, BaseUserManager[User, uuid.UUID]):
|
|||||||
finally:
|
finally:
|
||||||
CURRENT_TENANT_ID_CONTEXTVAR.reset(token)
|
CURRENT_TENANT_ID_CONTEXTVAR.reset(token)
|
||||||
|
|
||||||
logger.notice(f"User {user.id} has registered.")
|
logger.debug(f"User {user.id} has registered.")
|
||||||
optional_telemetry(
|
optional_telemetry(
|
||||||
record_type=RecordType.SIGN_UP,
|
record_type=RecordType.SIGN_UP,
|
||||||
data={"action": "create"},
|
data={"action": "create"},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user