File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -268,6 +268,8 @@ def process_findings(
268268 # Check if we should launch a chord (batch full or end of findings)
269269 if we_want_async (async_user = self .user ) and post_processing_task_signatures :
270270 # Calculate current batch size: 2^batch_number, capped at max_batch_size
271+ # We do this because post processing only starts after all tasks have been added to the chord
272+ # So we start with small batches to minmize the delay
271273 current_batch_size = min (2 ** current_batch_number , max_batch_size )
272274
273275 batch_full = len (post_processing_task_signatures ) >= current_batch_size
@@ -279,8 +281,8 @@ def process_findings(
279281 if system_settings .enable_product_grade :
280282 calculate_grade_signature = utils .calculate_grade_signature (product )
281283 chord (post_processing_task_signatures )(calculate_grade_signature )
282- # If product grading is disabled, just run the post-processing tasks without the grade calculation callback
283284 elif post_processing_task_signatures :
285+ # If product grading is disabled, just run the post-processing tasks without the grade calculation callback
284286 group (post_processing_task_signatures ).apply_async ()
285287
286288 logger .debug (f"Launched chord with { len (post_processing_task_signatures )} tasks (batch #{ current_batch_number } , size: { len (post_processing_task_signatures )} )" )
Original file line number Diff line number Diff line change @@ -272,6 +272,8 @@ def process_findings(
272272 # Check if we should launch a chord (batch full or end of findings)
273273 if we_want_async (async_user = self .user ) and post_processing_task_signatures :
274274 # Calculate current batch size: 2^batch_number, capped at max_batch_size
275+ # We do this because post processing only starts after all tasks have been added to the chord
276+ # So we start with small batches to minmize the delay
275277 current_batch_size = min (2 ** current_batch_number , max_batch_size )
276278
277279 batch_full = len (post_processing_task_signatures ) >= current_batch_size
@@ -284,8 +286,8 @@ def process_findings(
284286 if system_settings .enable_product_grade :
285287 calculate_grade_signature = utils .calculate_grade_signature (product )
286288 chord (post_processing_task_signatures )(calculate_grade_signature )
287- # If product grading is disabled, just run the post-processing tasks without the grade calculation callback
288289 elif post_processing_task_signatures :
290+ # If product grading is disabled, just run the post-processing tasks without the grade calculation callback
289291 group (post_processing_task_signatures ).apply_async ()
290292
291293 logger .debug (f"Launched chord with { len (post_processing_task_signatures )} tasks (batch #{ current_batch_number } , size: { len (post_processing_task_signatures )} )" )
You can’t perform that action at this time.
0 commit comments