Skip to content

Add Django 6.0 Tasks integration and configurable dispatchers - #545

Open
amanjain wants to merge 2 commits into
ui:masterfrom
amanjain:feat/task-dispatchers
Open

amanjain wants to merge 2 commits into
ui:masterfrom
amanjain:feat/task-dispatchers

Conversation

@amanjain

Copy link
Copy Markdown
Contributor

Django 6.0 introduced the built-in Tasks API. This adds an optional adapter and a TASK_DISPATCHER hook while preserving existing Celery behavior. Custom dispatchers also work on older supported Django versions without Celery.

@selwin, could you review this approach and approve the CI run if required?

Django 6.0 introduced the built-in Tasks API. Add an optional adapter and a
TASK_DISPATCHER hook to enqueue mail processing after database commit,
including routed bulk sends. Preserve existing Celery behavior and support
custom dispatchers on older Django versions.

Add compatibility and transaction tests, and document backend setup,
switching and periodic recovery.
@selwin

selwin commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator

@amanjain I think we shouldn’t touch celery’s tasks.py file at all. Could you create a new django_tasks file and work from there?

@selwin selwin closed this Oct 14, 2026
@selwin selwin reopened this Oct 14, 2026
Per review, leave post_office/tasks.py and its tests identical to main.
The dispatcher's signal handler now lives in task_dispatch.py, and
apps.py connects either it or the Celery handler, never both.
@amanjain

Copy link
Copy Markdown
Contributor Author

@selwin, updated. Celery’s tasks.py and its existing tests are unchanged from main. The Django Tasks adapter lives in django_tasks.py, with generic dispatcher handling in task_dispatch.py so it also works on older Django versions. apps.py connects only the selected handler.

This branch has not been deployed

No deployments
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