Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update AlgoliaUnreachableHostException to OperationTimeout #556

Open
dylancaponi opened this issue Mar 3, 2023 · 3 comments
Open

Update AlgoliaUnreachableHostException to OperationTimeout #556

dylancaponi opened this issue Mar 3, 2023 · 3 comments

Comments

@dylancaponi
Copy link

dylancaponi commented Mar 3, 2023

  • Algolia Client Version: 2.5.0 (I see that 3.0 was released 3 days ago, not sure if that resolves this)
  • Language Version: Python 3.9.7

Description

Client throws algoliasearch.exceptions.AlgoliaUnreachableHostException: Unreachable hosts during replace_all_objects operation. The issue was not that hosts were unreachable but that the operation was timing out. I fixed the problem by setting readTimeout to 100:

client = SearchClient.create(algolia_application_id, algolia_api_key)
index = client.init_index(algolia_index)
request_options = {
    "readTimeout": 100
}
index.replace_all_objects(records, request_options)

A timeout should produce a timeout error. Unreachable is misleading.

Steps To Reproduce

See description.
Use replace_all_objects on a sufficiently big index. Mine was 6393 rows and 10+ columns some with significant text blocks.

@shortcuts
Copy link
Member

Hey, thanks for the issue! We throw an unreachable host error because after a timeout error, we will try an other host (Algolia's API offers multiple), then if there's no host left we end up in an AlgoliaUnreachableHostException

I can however confirm that it can be misleading when doing large enough operations

@dylancaponi
Copy link
Author

I'm now seeing this error regardless how big I set the readTimeout. I've triple checked App ID and API Key.

@dylancaponi
Copy link
Author

Oh, you also get this message if the index does not exist. I would expect index does not Exist rather than an unreachable hosts error...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants