Skip to content

Commit 3f9989a

Browse files
committed
feat(async): Set "expires" for regulart tasks
Signed-off-by: kiblik <5609770+kiblik@users.noreply.github.com>
1 parent 54b9763 commit 3f9989a

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

dojo/settings/settings.dist.py

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1260,42 +1260,72 @@ def saml2_attrib_map_format(din):
12601260
"task": "dojo.tasks.add_alerts",
12611261
"schedule": timedelta(hours=1),
12621262
"args": [timedelta(hours=1)],
1263+
"options": {
1264+
"expires": int(60 * 60 * 1 * 1.2), # If a task is not executed within 72 minutes, it should be dropped from the queue. Two more tasks should be scheduled in the meantime.
1265+
},
12631266
},
12641267
"cleanup-alerts": {
12651268
"task": "dojo.tasks.cleanup_alerts",
12661269
"schedule": timedelta(hours=8),
1270+
"options": {
1271+
"expires": int(60 * 60 * 8 * 1.2), # If a task is not executed within 9.6 hours, it should be dropped from the queue. Two more tasks should be scheduled in the meantime.
1272+
},
12671273
},
12681274
"dedupe-delete": {
12691275
"task": "dojo.tasks.async_dupe_delete",
12701276
"schedule": timedelta(minutes=1),
1277+
"options": {
1278+
"expires": int(60 * 1 * 1.2), # If a task is not executed within 72 seconds, it should be dropped from the queue. Two more tasks should be scheduled in the meantime.
1279+
},
12711280
},
12721281
"flush_auditlog": {
12731282
"task": "dojo.tasks.flush_auditlog",
12741283
"schedule": timedelta(hours=8),
1284+
"options": {
1285+
"expires": int(60 * 60 * 8 * 1.2), # If a task is not executed within 9.6 hours, it should be dropped from the queue. Two more tasks should be scheduled in the meantime.
1286+
},
12751287
},
12761288
"update-findings-from-source-issues": {
12771289
"task": "dojo.tools.tool_issue_updater.update_findings_from_source_issues",
12781290
"schedule": timedelta(hours=3),
1291+
"options": {
1292+
"expires": int(60 * 60 * 3 * 1.2), # 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.
1293+
},
12791294
},
12801295
"compute-sla-age-and-notify": {
12811296
"task": "dojo.tasks.async_sla_compute_and_notify_task",
12821297
"schedule": crontab(hour=7, minute=30),
1298+
"options": {
1299+
"expires": int(60 * 60 * 24 * 1.2), # If a task is not executed within 28.8 hours, it should be dropped from the queue. Two more tasks should be scheduled in the meantime.
1300+
},
12831301
},
12841302
"risk_acceptance_expiration_handler": {
12851303
"task": "dojo.risk_acceptance.helper.expiration_handler",
1286-
"schedule": crontab(minute=0, hour="*/3"), # every 3 hours
1304+
"schedule": crontab(minute=0, hour="*/3"), # every 72 minutes
1305+
"options": {
1306+
"expires": int(60 * 60 * 3 * 1.2), # 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.
1307+
},
12871308
},
12881309
"notification_webhook_status_cleanup": {
12891310
"task": "dojo.notifications.helper.webhook_status_cleanup",
12901311
"schedule": timedelta(minutes=1),
1312+
"options": {
1313+
"expires": int(60 * 1 * 1.2), # If a task is not executed within 72 seconds, it should be dropped from the queue. Two more tasks should be scheduled in the meantime.
1314+
},
12911315
},
12921316
"trigger_evaluate_pro_proposition": {
12931317
"task": "dojo.tasks.evaluate_pro_proposition",
12941318
"schedule": timedelta(hours=8),
1319+
"options": {
1320+
"expires": int(60 * 60 * 8 * 1.2), # If a task is not executed within 9.6 hours, it should be dropped from the queue. Two more tasks should be scheduled in the meantime.
1321+
},
12951322
},
12961323
"clear_sessions": {
12971324
"task": "dojo.tasks.clear_sessions",
12981325
"schedule": crontab(hour=0, minute=0, day_of_week=0),
1326+
"options": {
1327+
"expires": int(60 * 60 * 24 * 7 * 1.2), # If a task is not executed within 8.4 days, it should be dropped from the queue. Two more tasks should be scheduled in the meantime.
1328+
},
12991329
},
13001330
# 'jira_status_reconciliation': {
13011331
# 'task': 'dojo.tasks.jira_status_reconciliation_task',

0 commit comments

Comments
 (0)