Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Heads up that task.delay() returns None, not AsyncResult. #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,20 @@ Celery's [user guide][1]. Send tasks from signal handlers without fear!
print_model.delay(model_pk)
transaction.commit()

## Caveats

Due to the task being sent after the current transaction has been commited, the
`PostTransactionTask` provided in this package does not return an
`celery.result.AsyncResult` as the original celery `Task` does.

Thus, `print_model.delay(model_pk)` simply returns `None`. In order to track
the task later on, the `task_id` can be predefined in the `apply_async` method:

from celery.utils import uuid

u = uuid()
print_model.apply_async((model_pk), {}, task_id=u)

## Run test suite

$ python setup.py test
Expand Down