Skip to content

Commit 76b9425

Browse files
Stop stripping sync from task kwargs and propagate it to sub-tasks
dojo_dispatch_task was popping sync from kwargs before running the task, preventing tasks from knowing they should run their own sub-tasks synchronously. Remove the pop so sync flows through to task functions. Add explicit sync parameter to post_process_findings_batch and forward it to calculate_grade so product grading also runs inline when the caller requests sync execution.
1 parent 5975458 commit 76b9425

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

dojo/celery_dispatch.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,6 @@ def dojo_dispatch_task(task_or_sig: _SupportsSi | _SupportsApplyAsync | Signatur
8484
# Track foreground execution as a "created task" as well (matches historical dojo_async_task behavior)
8585
dojo_async_task_counter.incr(str(sig.task), args=sig.args, kwargs=sig_kwargs)
8686

87-
sig_kwargs.pop("sync", None)
88-
sig = sig.clone(kwargs=sig_kwargs)
8987
eager = sig.apply()
9088
try:
9189
return eager.get(propagate=True)

dojo/finding/helper.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,7 @@ def post_process_findings_batch(
468468
push_to_jira=False,
469469
jira_instance_id=None,
470470
user=None,
471+
sync=False,
471472
**kwargs,
472473
):
473474

@@ -511,7 +512,7 @@ def post_process_findings_batch(
511512
if product_grading_option and system_settings.enable_product_grade:
512513
from dojo.celery_dispatch import dojo_dispatch_task # noqa: PLC0415 circular import
513514

514-
dojo_dispatch_task(calculate_grade, findings[0].test.engagement.product.id)
515+
dojo_dispatch_task(calculate_grade, findings[0].test.engagement.product.id, sync=sync)
515516

516517
# If we received the ID of a jira instance, then we need to determine the keep in sync behavior
517518
jira_instance = None

0 commit comments

Comments
 (0)