Skip to content

refactor dojo async task base task (bugfix branch)#14240

Open
valentijnscholten wants to merge 3 commits intoDefectDojo:bugfixfrom
valentijnscholten:remove-dojo-async-task-base-task-bugfix
Open

refactor dojo async task base task (bugfix branch)#14240
valentijnscholten wants to merge 3 commits intoDefectDojo:bugfixfrom
valentijnscholten:remove-dojo-async-task-base-task-bugfix

Conversation

@valentijnscholten
Copy link
Member

@valentijnscholten valentijnscholten commented Feb 4, 2026

Summary

This PR ports the async task refactor changes from #13986 to the bugfix branch.

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 asynchronously is now in a dispatch method.

Key Changes:

  • Removes @dojo_async_task decorator pattern
  • Introduces dojo_dispatch_task function for dispatching Celery tasks
  • Creates clean base task (PgHistoryTask) that preserves pghistory context
  • Updates all async task callers to use the new dispatch pattern

Pro needs similar changes via DefectDojo-Inc/dojo-pro#2124

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
asynchronously is now in a dispatch method.
@valentijnscholten valentijnscholten force-pushed the remove-dojo-async-task-base-task-bugfix branch from 2a17750 to d2d0bdc Compare February 4, 2026 17:36
- Use class reference instead of self for task dispatch
  (self.method returns bound method without .si() attribute)
- Update location_manager.py to use dojo_dispatch_task
  instead of @dojo_async_task decorator
- Convert task methods to static-like functions (no self parameter)
- Avoid passing manager/task attributes via instance
  (use class task objects to ensure .si() is available)
- Stop dispatching non-task jira_helper.push_to_jira through dojo_dispatch_task;
  call it directly and let it dispatch the underlying celery tasks
@valentijnscholten valentijnscholten marked this pull request as ready for review February 4, 2026 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant