Skip to content

Commit d8a9ac3

Browse files
committed
fix(php): pass linear timeout and return response
1 parent 55f1de3 commit d8a9ac3

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

clients/algoliasearch-client-php/lib/Support/Helpers.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,13 @@ public static function retryForApiKeyUntil(
151151

152152
// In case of an addition, if there was no error, the $key has been added as it should be
153153
if ('add' === $operation) {
154-
return;
154+
return $response;
155155
}
156156

157157
// In case of an update, check if the key has been updated as it should be
158158
if ('update' === $operation) {
159159
if (self::isKeyUpdated($response, $apiKey)) {
160-
return;
160+
return $response;
161161
}
162162
}
163163

@@ -166,9 +166,9 @@ public static function retryForApiKeyUntil(
166166
// In case of a deletion, if there was an error, the $key has been deleted as it should be
167167
if (
168168
'delete' === $operation
169-
&& 'Key does not exist' === $e->getMessage()
169+
&& $e->getCode() === 404
170170
) {
171-
return;
171+
return null;
172172
}
173173

174174
// Else try again ...

templates/php/api.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ use {{invokerPackage}}\Support\Helpers;
396396
$apiKey,
397397
$maxRetries,
398398
$timeout,
399-
null,
399+
'Algolia\AlgoliaSearch\Support\Helpers::linearTimeout',
400400
$requestOptions
401401
);
402402
}

0 commit comments

Comments
 (0)