Limit to once per day

This commit is contained in:
shamoon 2024-11-04 20:33:11 -08:00
parent aea537dc64
commit 496595fcdc

View File

@ -396,9 +396,13 @@ def check_scheduled_workflows():
elif ( elif (
trigger.schedule_is_recurring trigger.schedule_is_recurring
and workflow_runs.exists() 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( logger.debug(
f"Skipping document {document} for recurring workflow {workflow} as the last run was within the offset", f"Skipping document {document} for recurring workflow {workflow} as the last run was within the offset",
) )