From 496595fcdccb0f8d59f7e658b0874b4c01b936c5 Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Mon, 4 Nov 2024 20:33:11 -0800 Subject: [PATCH] Limit to once per day --- src/documents/tasks.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/documents/tasks.py b/src/documents/tasks.py index ccf243a89..bd6a1e716 100644 --- a/src/documents/tasks.py +++ b/src/documents/tasks.py @@ -396,9 +396,13 @@ def check_scheduled_workflows(): elif ( trigger.schedule_is_recurring and workflow_runs.exists() - and workflow_runs.last().run_at > timezone.now() - offset_td + and ( + workflow_runs.last().run_at > timezone.now() - offset_td + or workflow_runs.last().run_at + > timezone.now() - timedelta(days=1) + ) ): - # schedule is recurring but the last run was within the offset + # schedule is recurring but the last run was within the offset or within 24 hours of the last run logger.debug( f"Skipping document {document} for recurring workflow {workflow} as the last run was within the offset", )