Signals for transaction commit/rollback
|Reported by:||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||1.3|
|Cc:||Andreas Pelme, asksol, Brodie Rao, Chris Streeter, dtrebbien, anssi.kaariainen@…, glicerinu@…, hv@…, boxed, German M. Bravo, kmike84@…||Triage Stage:||Design decision needed|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Some users of django-celery have the problem of publishing references to database state that has not yet been commited.
def add_user(request): user = User.objects.create(...) # Import the users address book contacts asynchronously using the worker pool. import_contacts.delay(user.pk)
The proposed solution is to add a way to delay these calls until the transaction is committed:
from djcelery import on_transaction_commit def add_user(request): user = User.objects.create(...) on_transaction_commit(import_contacts.delay, user.pk)
I can't see any mechanism to hook into commit/rollback, so it doesn't seem easy
Do you think it could be possible to add new signals for transaction commit/rollback?
Change History (41)
comment:1 Changed 6 years ago by
|Patch needs improvement:||unset|