Skip to content

Commit

Permalink
simpler CELERY_ALWAYS_EAGER support
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasgrasset committed Mar 26, 2014
1 parent 725fdbf commit 33868fc
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions djcelery_transactions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def apply_async(cls, *args, **kwargs):
# Delay the task unless the client requested otherwise or transactions
# aren't being managed (i.e. the signal handlers won't send the task).

if transaction.is_managed():
if transaction.is_managed() and not current_app.conf.CELERY_ALWAYS_EAGER:
if not transaction.is_dirty():
# Always mark the transaction as dirty
# because we push task in queue that must be fired or discarded
Expand All @@ -62,8 +62,6 @@ def apply_async(cls, *args, **kwargs):
_get_task_queue().append((cls, args, kwargs))
else:
apply_async_orig = super(PostTransactionTask, cls).apply_async
if current_app.conf.CELERY_ALWAYS_EAGER:
apply_async_orig = transaction.autocommit()(apply_async_orig)
return apply_async_orig(*args, **kwargs)


Expand Down

0 comments on commit 33868fc

Please sign in to comment.