diff --git a/api/schedule/clean_workflow_runs_task.py b/api/schedule/clean_workflow_runs_task.py index b59dc7f823..0f34c534ab 100644 --- a/api/schedule/clean_workflow_runs_task.py +++ b/api/schedule/clean_workflow_runs_task.py @@ -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). diff --git a/api/services/clear_free_plan_expired_workflow_run_logs.py b/api/services/clear_free_plan_expired_workflow_run_logs.py index c3fbd6600a..0589bb4868 100644 --- a/api/services/clear_free_plan_expired_workflow_run_logs.py +++ b/api/services/clear_free_plan_expired_workflow_run_logs.py @@ -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