diff --git a/dojo/importers/default_importer.py b/dojo/importers/default_importer.py index 188a31b6acb..9ed825828aa 100644 --- a/dojo/importers/default_importer.py +++ b/dojo/importers/default_importer.py @@ -157,6 +157,7 @@ def process_findings( parsed_findings: list[Finding], **kwargs: dict, ) -> list[Finding]: + sync_requested = kwargs.get("sync", True) # Progressive batching for chord execution post_processing_task_signatures = [] current_batch_number = 1 @@ -253,7 +254,7 @@ def process_findings( post_processing_task_signatures.append(post_processing_task_signature) # Check if we should launch a chord (batch full or end of findings) - if we_want_async(async_user=self.user) and post_processing_task_signatures: + if we_want_async(async_user=self.user, sync=sync_requested) and post_processing_task_signatures: post_processing_task_signatures, current_batch_number, _ = self.maybe_launch_post_processing_chord( post_processing_task_signatures, current_batch_number, @@ -283,8 +284,7 @@ def process_findings( # Always perform an initial grading, even though it might get overwritten later. perform_product_grading(self.test.engagement.product) - sync = kwargs.get("sync", True) - if not sync: + if not sync_requested: return [serialize("json", [finding]) for finding in new_findings] return new_findings diff --git a/dojo/importers/default_reimporter.py b/dojo/importers/default_reimporter.py index 4813d92453a..7160f22e35e 100644 --- a/dojo/importers/default_reimporter.py +++ b/dojo/importers/default_reimporter.py @@ -164,6 +164,7 @@ def process_findings( the finding may be appended to a new or existing group based upon user selection at import time """ + sync_requested = kwargs.get("sync", True) self.deduplication_algorithm = self.determine_deduplication_algorithm() # Only process findings with the same service value (or None) # Even though the service values is used in the hash_code calculation, @@ -271,7 +272,7 @@ def process_findings( post_processing_task_signatures.append(post_processing_task_signature) # Check if we should launch a chord (batch full or end of findings) - if we_want_async(async_user=self.user) and post_processing_task_signatures: + if we_want_async(async_user=self.user, sync=sync_requested) and post_processing_task_signatures: post_processing_task_signatures, current_batch_number, _ = self.maybe_launch_post_processing_chord( post_processing_task_signatures, current_batch_number, @@ -772,6 +773,4 @@ def calculate_unsaved_finding_hash_code( self, unsaved_finding: Finding, ) -> str: - # this is overridden in Pro, but will still call this via super() - deduplicationLogger.debug("Calculating hash code for unsaved finding") return unsaved_finding.compute_hash_code()