celery-haystack icon indicating copy to clipboard operation
celery-haystack copied to clipboard

When using a database table broker, django-celery-transactions breaks commit_on_success decorator

Open miracle2k opened this issue 12 years ago • 1 comments

This is a curious one; I'm only guessing this is the right project to report the bug; I don't see an obvious way to fix it though, and it is a bit of an edge case.

  • My function uses @transaction.commit_on_success.
  • It saves a model instance that is attached to a search index.
  • Via a post_save hook, celery-haystack wants to send the update task to celery.
  • django-celery-transactions holds the task back for now.
  • My function ends, commit_on_success executes a COMMIT, sets the connection is_dirty flag to False.
  • django-celery-transactions, via it's post_commit patching, now triggers the celery task sends.
  • Since I'm using the database broker, the database connection is dirtied again in this step.
  • Finally, the code of Django's commit_on_success decorator calls leave_transaction_management, which checks the dirty flag and fails with: ```django-celery-transactions`.

This is using Django 1.5 and Haystack 2 Beta.

miracle2k avatar May 01 '13 22:05 miracle2k

Oh man, what a mess. Is there any way to easily reproduce it? Or a traceback? Not sure if this really can be done here, but I'd love to fix this of course.

jezdez avatar May 08 '13 06:05 jezdez