From 8fc5b586230fc304725903995d3326dfc78f8b81 Mon Sep 17 00:00:00 2001 From: Michael Fladischer Date: Tue, 22 Oct 2013 17:38:25 +0200 Subject: [PATCH] Heads up that task.delay() returns None, not AsyncResult. --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index c2a976e..eee1f54 100644 --- a/README.md +++ b/README.md @@ -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