Skip to content

refactor dojo async task base task#13986

Closed
valentijnscholten wants to merge 46 commits intoDefectDojo:devfrom
valentijnscholten:remove-dojo-async-task-base-task
Closed

refactor dojo async task base task#13986
valentijnscholten wants to merge 46 commits intoDefectDojo:devfrom
valentijnscholten:remove-dojo-async-task-base-task

Conversation

@valentijnscholten
Copy link
Member

@valentijnscholten valentijnscholten commented Dec 26, 2025

The custom decorators that we have on Celery tasks interfere with some (advanced) celery functionality like signatures. This PR refactors this to have a clean base task that passes on context, but does not interfere with celery mechanisms.

The logic to decide whether or not the task is to be called asyncrhonously is now in a dispatch method.

Pro needs similar changes via https://github.com/DefectDojo-Inc/dojo-pro/pull/973, these must be merged "at the same time".

@valentijnscholten valentijnscholten added this to the 2.55.0 milestone Dec 26, 2025
@github-actions github-actions bot added settings_changes Needs changes to settings.py based on changes in settings.dist.py included in this PR apiv2 unittests ui parser labels Dec 26, 2025
@valentijnscholten valentijnscholten added the affects_pro PRs that affect Pro and need a coordinated release/merge moment. label Dec 27, 2025
@valentijnscholten valentijnscholten changed the title remove dojo async task base task refactor dojo async task base task Dec 28, 2025
@github-actions
Copy link
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions
Copy link
Contributor

Conflicts have been resolved. A maintainer will review the pull request shortly.

@valentijnscholten valentijnscholten force-pushed the remove-dojo-async-task-base-task branch from 31a5314 to 917aa72 Compare January 5, 2026 19:17
@github-actions
Copy link
Contributor

Conflicts have been resolved. A maintainer will review the pull request shortly.

@github-actions
Copy link
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

…sk-base-task

# Conflicts:
#	dojo/endpoint/views.py
#	unittests/test_importers_performance.py
@github-actions
Copy link
Contributor

Conflicts have been resolved. A maintainer will review the pull request shortly.

Copy link
Contributor

@Maffooch Maffooch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested by hand in all the places

@dogboat
Copy link
Contributor

dogboat commented Jan 30, 2026

This looks great but will probably cause conflicts with the locations PR; at the least, some of the code there will need to be updated to take advantage of these improvements. Maybe we should hold off on merging this one until the next release? @mtesauro

Copy link
Contributor

@mtesauro mtesauro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to hold on this until after Locations lands as getting Locations in place allows other code changes to move forward while avoiding inevitable conflicts.

@valentijnscholten
Copy link
Member Author

I don't really mind if we merge this one before monday or shortly after. But we have to be aware that any async tasks related to endpoints should probably be converted into synchronous code or be called with sync=True because Locations are considered for deduplication.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 2, 2026

This pull request has conflicts, please resolve those before we can evaluate the pull request.

…sk-base-task

# Conflicts:
#	dojo/importers/base_importer.py
#	dojo/product/helpers.py
#	dojo/tags_signals.py
#	dojo/utils.py
- Remove @dojo_async_task decorator
- Use dojo_dispatch_task for calling Celery tasks
- Convert task methods to static-like functions (no self parameter)
- Make get_or_create_location and clean_unsaved_locations static methods
@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

Conflicts have been resolved. A maintainer will review the pull request shortly.

@valentijnscholten
Copy link
Member Author

Closed in favor of #14240

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

affects_pro PRs that affect Pro and need a coordinated release/merge moment. apiv2 parser ui unittests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants