mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-04-07 19:38:19 +02:00
update logic for tenancy
This commit is contained in:
parent
7419bf6b06
commit
ee831b73e4
@ -454,11 +454,7 @@ def check_for_prune_task(tenant_id: str | None) -> None:
|
||||
def schedule_tenant_tasks() -> None:
|
||||
tenants = get_all_tenant_ids()
|
||||
|
||||
# Filter out any invalid tenants if necessary
|
||||
valid_tenants = [tenant for tenant in tenants if tenant is None or not tenant.startswith('pg_')]
|
||||
logger.info(f"Scheduling tasks for tenants: {valid_tenants}")
|
||||
|
||||
for tenant_id in valid_tenants:
|
||||
for tenant_id in tenants:
|
||||
# Schedule tasks specific to each tenant
|
||||
celery_app.conf.beat_schedule[f"check-for-document-set-sync-{tenant_id}"] = {
|
||||
"task": "check_for_document_sets_sync_task",
|
||||
|
@ -399,7 +399,9 @@ def get_all_tenant_ids() -> list[str] | list[None]:
|
||||
WHERE schema_name NOT IN ('pg_catalog', 'information_schema', 'public')
|
||||
"""))
|
||||
tenant_ids = [row[0] for row in result]
|
||||
return tenant_ids
|
||||
valid_tenants = [tenant for tenant in tenant_ids if tenant is None or not tenant.startswith('pg_')]
|
||||
|
||||
return valid_tenants
|
||||
|
||||
|
||||
def update_loop(
|
||||
@ -443,17 +445,7 @@ def update_loop(
|
||||
)
|
||||
|
||||
try:
|
||||
tenants: list[str | None] = []
|
||||
if MULTI_TENANT:
|
||||
tenants = [
|
||||
tenant for tenant in tenants
|
||||
if tenant is None or not tenant.startswith('pg_')
|
||||
]
|
||||
else:
|
||||
tenants = tenants
|
||||
if MULTI_TENANT:
|
||||
logger.info(f"Found valid tenants: {tenants}")
|
||||
|
||||
tenants = get_all_tenant_ids()
|
||||
|
||||
for tenant_id in tenants:
|
||||
try:
|
||||
|
Loading…
x
Reference in New Issue
Block a user