django-haystack / django-haystack/celery-haystack
When using a database table broker, django-celery-transactions breaks commit_on_success decorator
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 226
- Forks
- 95
- PR merge metrics
- No merged PRs in 30d
Description
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-haystackwants to send the update task to celery. django-celery-transactionsholds the task back for now.- My function ends,
commit_on_successexecutes aCOMMIT, sets the connectionis_dirtyflag to False. django-celery-transactions, via it'spost_commitpatching, 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_successdecorator callsleave_transaction_management, which checks the dirty flag and fails with: ```django-celery-transactions`.
This is using Django 1.5 and Haystack 2 Beta.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the sequence involving Django 1.5's transaction.commit_on_success, the post_save hook, django-celery-transactions' post_commit patching, and a database broker. Trace the connection's is_dirty flag through the final leave_transaction_management call. Done means the Celery task can be sent after commit without the decorator failing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- django, python
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100