Skip to content

Attempt to execute celery tasks after transaction commit. Hacking around django transaction and celery task execution.

Notifications You must be signed in to change notification settings

yunmanger1/django-celery-xa

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Attempt to execute celery tasks after transaction commit!

Based on https://gist.github.com/247844 by Grégoire Cachet

from celery.task import task
from celery_xa.utils.patcher import celery_xa_patch

@celery_xa_patch
@task
def add(x, y):
    return x + y
    
    
# if settings.BROKER_TRANSPORT == "django" or transaction.is_managed() == False task will be executed normally,
# otherwise it will be executed after commit.  
add.delay(2,3)

About

Attempt to execute celery tasks after transaction commit. Hacking around django transaction and celery task execution.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages