Skip to content

Commit cd49b1d

Browse files
Remove dead sync_process_findings / determine_process_method / process_results scaffolding (#14351)
These three methods were introduced to support the ASYNC_FINDING_IMPORT feature (async dispatch of findings processing to Celery). That feature has since been removed, leaving a three-layer indirection: process_scan -> determine_process_method -> sync_process_findings -> process_findings -> process_results None of this routing logic has any effect anymore: - sync_process_findings just delegates to process_findings - determine_process_method just delegates to sync_process_findings - process_results just returns self.new_items / self.reactivated_items / etc. Collapse the call chain so process_scan calls process_findings directly and process_findings returns the finding lists directly. This also fixes the indirection that was the root cause of #14309's performance test failures.
1 parent 85a7216 commit cd49b1d

3 files changed

Lines changed: 3 additions & 34 deletions

File tree

dojo/importers/base_importer.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -284,27 +284,6 @@ def parse_findings(
284284
logger.info(f"Parsing findings took {elapsed_time:.2f} seconds ({len(parsed_findings) if parsed_findings else 0} findings parsed)")
285285
return parsed_findings
286286

287-
def sync_process_findings(
288-
self,
289-
parsed_findings: list[Finding],
290-
**kwargs: dict,
291-
) -> tuple[list[Finding], list[Finding], list[Finding], list[Finding]]:
292-
"""
293-
Processes findings in a synchronous manner such that all findings
294-
will be processed in a worker/process/thread
295-
"""
296-
return self.process_findings(parsed_findings, **kwargs)
297-
298-
def determine_process_method(
299-
self,
300-
parsed_findings: list[Finding],
301-
**kwargs: dict,
302-
) -> list[Finding]:
303-
return self.sync_process_findings(
304-
parsed_findings,
305-
**kwargs,
306-
)
307-
308287
def determine_deduplication_algorithm(self) -> str:
309288
"""
310289
Determines what dedupe algorithm to use for the Test being processed.

dojo/importers/default_importer.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,7 @@ def process_scan(
110110
# Get the findings from the parser based on what methods the parser supplies
111111
# This could either mean traditional file parsing, or API pull parsing
112112
parsed_findings = self.parse_findings(scan, parser) or []
113-
# process the findings in the foreground or background
114-
new_findings = self.determine_process_method(parsed_findings, **kwargs)
113+
new_findings = self.process_findings(parsed_findings, **kwargs)
115114
# Close any old findings in the processed list if the the user specified for that
116115
# to occur in the form that is then passed to the kwargs
117116
closed_findings = self.close_old_findings(self.test.finding_set.all(), **kwargs)

dojo/importers/default_reimporter.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,12 @@ def process_scan(
102102
# Get the findings from the parser based on what methods the parser supplies
103103
# This could either mean traditional file parsing, or API pull parsing
104104
parsed_findings = self.parse_findings(scan, parser) or []
105-
# process the findings in the foreground or background
106105
(
107106
new_findings,
108107
reactivated_findings,
109108
findings_to_mitigate,
110109
untouched_findings,
111-
) = self.determine_process_method(parsed_findings, **kwargs)
110+
) = self.process_findings(parsed_findings, **kwargs)
112111
# Close any old findings in the processed list if the the user specified for that
113112
# to occur in the form that is then passed to the kwargs
114113
closed_findings = self.close_old_findings(findings_to_mitigate, **kwargs)
@@ -462,8 +461,7 @@ def process_findings(
462461
# Synchronous tasks were already executed during processing, just calculate grade
463462
perform_product_grading(self.test.engagement.product)
464463

465-
# Process the results and return them back
466-
return self.process_results(**kwargs)
464+
return self.new_items, self.reactivated_items, self.to_mitigate, self.untouched
467465

468466
def close_old_findings(
469467
self,
@@ -1008,13 +1006,6 @@ def process_groups_for_all_findings(
10081006
if self.push_to_jira or is_keep_in_sync_with_jira(finding_group, prefetched_jira_instance=self.jira_instance):
10091007
jira_helper.push_to_jira(finding_group)
10101008

1011-
def process_results(
1012-
self,
1013-
**kwargs: dict,
1014-
) -> tuple[list[Finding], list[Finding], list[Finding], list[Finding]]:
1015-
"""Return the finding lists collected during process_findings."""
1016-
return self.new_items, self.reactivated_items, self.to_mitigate, self.untouched
1017-
10181009
def calculate_unsaved_finding_hash_code(
10191010
self,
10201011
unsaved_finding: Finding,

0 commit comments

Comments
 (0)