You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
disable_auto_indexing() in decorators.py makes connection even if AUTO_INDEXING = False .
In AUTO_INDEXING = False environment, once disable_auto_indexing() is called, AlgoliaEngine will try to index when model saving.
def __exit__(self, exc_type, exc_value, traceback):
for model in self.models:
post_save.connect(
algolia_engine._AlgoliaEngine__post_save_receiver,
sender=model
)
pre_delete.connect(
algolia_engine._AlgoliaEngine__pre_delete_receiver,
sender=model
)
I think it needs condition if AUTO_INDEXING is True, like bellow.
def __exit__(self, exc_type, exc_value, traceback):
if some_auto_indexing # this
for model in self.models:
post_save.connect(
algolia_engine._AlgoliaEngine__post_save_receiver,
sender=model
)
pre_delete.connect(
algolia_engine._AlgoliaEngine__pre_delete_receiver,
sender=model
)
from algoliasearch_django.decorators import disable_auto_indexing
with disable_auto_indexing():
pass
SomeModel().save() # -> Error will be Occured
a part of error message
algoliasearch.helpers.AlgoliaException: Unreachable hosts: {'foo.algolia.net': "ConnectionError: HTTPSConnectionPool(host='foo.algolia.net', port=443): Max retries exceeded with url: /1/indexes/SomeModel/236 (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f126590d550>: Failed to establish a new connection: [Errno -2] Name or service not known',))", 'foo-1.algolianet.com': "ConnectionError: HTTPSConnectionPool(host='foo-1.algolianet.com', port=443): Max retries exceeded with url: /1/indexes/SomeModel/236 (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f1265941da0>: Failed to establish a new connection: [Errno -2] Name or service not known',))", 'foo-3.algolianet.com': "ConnectionError: HTTPSConnectionPool(host='foo-3.algolianet.com', port=443): Max retries exceeded with url: /1/indexes/SomeModel/236 (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f126590dc88>: Failed to establish a new connection: [Errno -2] Name or service not known',))", 'foo-2.algolianet.com': "ConnectionError: HTTPSConnectionPool(host='foo-2.algolianet.com', port=443): Max retries exceeded with url: /1/indexes/SomeModel/236 (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f12656d8208>: Failed to establish a new connection: [Errno -2] Name or service not known',))"}
The text was updated successfully, but these errors were encountered:
Hi @kasai-mitsuru that's a great point!
I see another problem with this API: it's disabling indexing over all the models whilst giving the illusion it's only affecting the scope it's encapsulating. This whole API should be re-engineered into something more flexible that can enable/disable indexing on specific registrations.
Description
disable_auto_indexing()
indecorators.py
makes connection even ifAUTO_INDEXING = False
.In
AUTO_INDEXING = False
environment, oncedisable_auto_indexing()
is called, AlgoliaEngine will try to index when model saving.I think it needs condition if AUTO_INDEXING is True, like bellow.
Steps To Reproduce
settings.py
index.py
sample.py
a part of error message
The text was updated successfully, but these errors were encountered: