From 2a2f3066e99a7ca9caa170d321084ddbf8e40117 Mon Sep 17 00:00:00 2001 From: kiblik <5609770+kiblik@users.noreply.github.com> Date: Mon, 26 Jan 2026 20:17:48 +0100 Subject: [PATCH] feat(async): Set "expires" for regulart tasks Signed-off-by: kiblik <5609770+kiblik@users.noreply.github.com> --- dojo/settings/settings.dist.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/dojo/settings/settings.dist.py b/dojo/settings/settings.dist.py index 6798d66cfa1..6d88a76ff25 100644 --- a/dojo/settings/settings.dist.py +++ b/dojo/settings/settings.dist.py @@ -1233,43 +1233,73 @@ def saml2_attrib_map_format(din): "task": "dojo.tasks.add_alerts", "schedule": timedelta(hours=1), "args": [timedelta(hours=1)], + "options": { + "expires": 60 * 60 * 1 * 3, # If a task is not executed within 3 hours, it should be dropped from the queue. Two more tasks should be scheduled in the meantime. + }, }, "cleanup-alerts": { "task": "dojo.tasks.cleanup_alerts", "schedule": timedelta(hours=8), + "options": { + "expires": 60 * 60 * 8 * 3, # If a task is not executed within 24 hours, it should be dropped from the queue. Two more tasks should be scheduled in the meantime. + }, }, "dedupe-delete": { "task": "dojo.tasks.async_dupe_delete", "schedule": timedelta(minutes=1), "args": [timedelta(minutes=1)], + "options": { + "expires": 60 * 1 * 3, # If a task is not executed within 3 minutes, it should be dropped from the queue. Two more tasks should be scheduled in the meantime. + }, }, "flush_auditlog": { "task": "dojo.tasks.flush_auditlog", "schedule": timedelta(hours=8), + "options": { + "expires": 60 * 60 * 8 * 3, # If a task is not executed within 24 hours, it should be dropped from the queue. Two more tasks should be scheduled in the meantime. + }, }, "update-findings-from-source-issues": { "task": "dojo.tools.tool_issue_updater.update_findings_from_source_issues", "schedule": timedelta(hours=3), + "options": { + "expires": 60 * 60 * 3 * 3, # If a task is not executed within 9 hours, it should be dropped from the queue. Two more tasks should be scheduled in the meantime. + }, }, "compute-sla-age-and-notify": { "task": "dojo.tasks.async_sla_compute_and_notify_task", "schedule": crontab(hour=7, minute=30), + "options": { + "expires": 60 * 60 * 24 * 3, # If a task is not executed within 3 days, it should be dropped from the queue. Two more tasks should be scheduled in the meantime. + }, }, "risk_acceptance_expiration_handler": { "task": "dojo.risk_acceptance.helper.expiration_handler", "schedule": crontab(minute=0, hour="*/3"), # every 3 hours + "options": { + "expires": 60 * 60 * 3 * 3, # If a task is not executed within 9 hours, it should be dropped from the queue. Two more tasks should be scheduled in the meantime. + }, }, "notification_webhook_status_cleanup": { "task": "dojo.notifications.helper.webhook_status_cleanup", "schedule": timedelta(minutes=1), + "options": { + "expires": 60 * 1 * 3, # If a task is not executed within 3 minutes, it should be dropped from the queue. Two more tasks should be scheduled in the meantime. + }, }, "trigger_evaluate_pro_proposition": { "task": "dojo.tasks.evaluate_pro_proposition", "schedule": timedelta(hours=8), + "options": { + "expires": 60 * 60 * 8 * 3, # If a task is not executed within 24 hours, it should be dropped from the queue. Two more tasks should be scheduled in the meantime. + }, }, "clear_sessions": { "task": "dojo.tasks.clear_sessions", "schedule": crontab(hour=0, minute=0, day_of_week=0), + "options": { + "expires": 60 * 60 * 24 * 7 * 3, # If a task is not executed within 3 weeks, it should be dropped from the queue. Two more tasks should be scheduled in the meantime. + }, }, # 'jira_status_reconciliation': { # 'task': 'dojo.tasks.jira_status_reconciliation_task',