mirror of https://github.com/langgenius/dify.git
add batch limit
This commit is contained in:
parent
c42e7c8a97
commit
774286797d
|
|
@ -4,10 +4,8 @@ import app
|
|||
from configs import dify_config
|
||||
from services.clear_free_plan_expired_workflow_run_logs import WorkflowRunCleanup
|
||||
|
||||
CLEANUP_QUEUE = "retention"
|
||||
|
||||
|
||||
@app.celery.task(queue=CLEANUP_QUEUE)
|
||||
@app.celery.task(queue="retention")
|
||||
def clean_workflow_runs_task() -> None:
|
||||
"""
|
||||
Scheduled cleanup for workflow runs and related records (sandbox tenants only).
|
||||
|
|
|
|||
|
|
@ -39,6 +39,9 @@ class WorkflowRunCleanup:
|
|||
if self.window_start and self.window_end <= self.window_start:
|
||||
raise ValueError("end_before must be greater than start_after.")
|
||||
|
||||
if batch_size <= 0:
|
||||
raise ValueError("batch_size must be greater than 0.")
|
||||
|
||||
self.batch_size = batch_size
|
||||
self.billing_cache: dict[str, TenantPlanInfo | None] = {}
|
||||
self.dry_run = dry_run
|
||||
|
|
|
|||
Loading…
Reference in New Issue