Skip to content

Support sync kwarg in process_findings for inline post-processing#14309

Open
valentijnscholten wants to merge 3 commits intoDefectDojo:bugfixfrom
valentijnscholten:fix/async-import-optimization
Open

Support sync kwarg in process_findings for inline post-processing#14309
valentijnscholten wants to merge 3 commits intoDefectDojo:bugfixfrom
valentijnscholten:fix/async-import-optimization

Conversation

@valentijnscholten
Copy link
Member

@valentijnscholten valentijnscholten commented Feb 12, 2026

Summary

  • Thread sync kwarg from process_findings() through to dojo_dispatch_task() in both DefaultImporter and DefaultReImporter, so callers can force post_process_findings_batch to run inline.
  • Pop sync from kwargs in sync_process_findings() to avoid duplicate keyword argument errors.

@github-actions github-actions bot added the settings_changes Needs changes to settings.py based on changes in settings.dist.py included in this PR label Feb 12, 2026
Thread the sync kwarg from process_findings through to dojo_dispatch_task
in both DefaultImporter and DefaultReImporter so callers can force
post_process_findings_batch to run inline instead of spawning additional
Celery tasks. Pop sync from kwargs in sync_process_findings to avoid
duplicate keyword argument errors.
@valentijnscholten valentijnscholten force-pushed the fix/async-import-optimization branch from 87b77c1 to 6835a3b Compare February 12, 2026 19:06
@github-actions github-actions bot removed the settings_changes Needs changes to settings.py based on changes in settings.dist.py included in this PR label Feb 12, 2026
The reimporter's process_results() checks kwargs.get("sync") to decide
whether to return real Finding objects or serialized JSON strings. Using
kwargs.pop() removed sync before process_results could see it, causing
findings_to_mitigate to contain JSON strings instead of Finding objects
and crashing close_old_findings with:
  AttributeError: 'str' object has no attribute 'refresh_from_db'

Switch from pop() to get() so sync remains in kwargs for process_results.
…akage

The sync=True injected by sync_process_findings was leaking through to
dojo_dispatch_task(post_process_findings_batch), forcing it to run
synchronously instead of async. This caused +7 to +61 extra queries in
performance tests.

- Remove sync=True from sync_process_findings (dead since ASYNC_FINDING_IMPORT removal)
- Remove sync kwarg threading in process_findings for both importers
- Remove dead serialization branches in process_results and process_findings
- Remove unused django.core.serializers imports
@Maffooch Maffooch marked this pull request as ready for review February 13, 2026 20:01
@Maffooch Maffooch added this to the 2.55.3 milestone Feb 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants