-
Notifications
You must be signed in to change notification settings - Fork 113
Closed
algolia/api-clients-automation
#3938Description
Description
In v3
of the library, the "read" hosts were used (see https://github.com/algolia/algoliasearch-client-php/blob/v3/src/Iterators/ObjectIterator.php#L36).
In v4
, the hosts are solely determined on the HTTP method (in this case POST
), which leads to the use of the "write" hosts.
This can have drastic implications, as we've found out.
For example, when browsing objects just after an update, the update may not have been propagated.
In our case/app, it lead to the accidental deletion of records in the following scenario:
- Records are synchronized to the search index. For each record
syncedOn: {sync_time}
is set. Task completion is awaited. - Stale records (in the search index) are identified through
/browse
(syncedOn < {sync_time}
). All updated records are also included in the result⚠️
Client
Search
Version
4.4.3
Relevant log output
[
{
"jsonPayload":{
"message":"Algolia API client: Response received.",
"context":{
"method":"POST",
"host":"https://{appId}.algolia.net/1/indexes/{index}/batch",
"body":{
"requests":[
{
"body":{
"objectID":"3bbfb6619dc41a84a3953ee717784b7f",
"syncedOn":1727261466
},
"action":"partialUpdateObjectNoCreate"
}
]
},
"response":{
"taskID":2239298392002,
"objectIDs":[
"3bbfb6619dc41a84a3953ee717784b7f"
]
}
}
},
"timestamp":"2024-09-25T10:51:07.786Z",
"severity":"DEBUG",
"receiveTimestamp":"2024-09-25T10:51:07.926957805Z"
},
{
"jsonPayload":{
"message":"Algolia API client: Response received.",
"context":{
"method":"GET",
"host":"https://{appId}-dsn.algolia.net/1/indexes/{index}/task/2239298392002",
"body":null,
"response":{
"status":"published",
"pendingTask":false
}
}
},
"timestamp":"2024-09-25T10:51:09.877Z",
"severity":"DEBUG",
"receiveTimestamp":"2024-09-25T10:51:09.926139931Z"
},
{
"jsonPayload":{
"message":"Algolia API client: Response received.",
"context":{
"method":"POST",
"host":"https://{appId}.algolia.net/1/indexes/{index}/browse",
"body":{
"hitsPerPage":1000,
"filters":"syncedOn < 1727261466"
},
"response":{
"query":"",
"processingTimeMS":2,
"hits":[
{
"synced_on":1727226487,
"objectID":"3bbfb6619dc41a84a3953ee717784b7f"
}
]
}
}
},
"timestamp":"2024-09-25T10:51:09.913Z",
"severity":"DEBUG",
"receiveTimestamp":"2024-09-25T10:51:09.926139931Z"
}
]
Metadata
Metadata
Assignees
Labels
No labels