mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-07-31 01:42:04 +08:00
fix: add batch size to ClearFreePlainTenantExpiredLogs to avoid blocking
This commit is contained in:
parent
83136ee4e8
commit
3835ae9364
@ -149,7 +149,9 @@ class ClearFreePlanTenantExpiredLogs:
|
|||||||
|
|
||||||
while True:
|
while True:
|
||||||
with Session(db.engine).no_autoflush as session:
|
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:
|
if len(workflow_runs) == 0:
|
||||||
break
|
break
|
||||||
|
Loading…
x
Reference in New Issue
Block a user