fix: add batch size to ClearFreePlainTenantExpiredLogs to avoid blocking

This commit is contained in:
Yeuoly 2025-03-21 21:49:58 +08:00
parent 83136ee4e8
commit 3835ae9364

View File

@ -149,7 +149,9 @@ class ClearFreePlanTenantExpiredLogs:
while True:
with Session(db.engine).no_autoflush as session:
workflow_runs = session.query(WorkflowRun).filter(WorkflowRun.tenant_id == tenant_id).all()
workflow_runs = (
session.query(WorkflowRun).filter(WorkflowRun.tenant_id == tenant_id).limit(batch).all()
)
if len(workflow_runs) == 0:
break