algolia / algolia/algoliasearch-client-python

Update AlgoliaUnreachableHostException to OperationTimeout

Open
#556 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
207
Forks
63
PR merge metrics
No merged PRs in 30d

Description

- 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.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the timeout handling for replace_all_objects in the Python client and how it maps failures to AlgoliaUnreachableHostException. Reproduce the operation with a sufficiently large index, then verify that a read timeout reports OperationTimeout while genuinely unreachable hosts still report the host exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.