algolia / algoliasearch-django

Seamless integration of Algolia into your Django project.
https://www.algolia.com
MIT License
173 stars 65 forks source link

Algolia doesn't handle Django Atomic Transactions #278

Open sameerkumar18 opened 5 years ago

sameerkumar18 commented 5 years ago

Consider - Auto-Index to be True

Description

While in a Django atomic transaction, if anytime save() is called - algolia is instantly updated. If due to some exception that atomic transaction fails, Algolia would still be updated with invalid values that do not match the database.

Steps To Reproduce

Step 1 - Import your model from app, import django transaction

>>> from myapp import mymodel
>>> from django import transaction

Step 2 - Start a transaction // Consider there is boolean field status in model mymodel

>>> with transaction.atomic():
            obj = mymodel.objects.first()
            obj.status = False
            obj.save() # Algolia gets updated here
            raise Exception('something here') # This cancels/doesn't commit anything to the database
nunomaduro commented 5 years ago

Thanks for bring this up to our attention, we will take a look soon as possible.

sameerkumar18 commented 5 years ago

Any update here @nunomaduro ?

mohiuddin06617 commented 1 year ago

Any update on this issue @nunomaduro ?