Skip to content

Commit

Permalink
fix(php): pass linear timeout and return response
Browse files Browse the repository at this point in the history
  • Loading branch information
Fluf22 committed Jul 12, 2024
1 parent 55f1de3 commit d8a9ac3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions clients/algoliasearch-client-php/lib/Support/Helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,13 @@ public static function retryForApiKeyUntil(

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

// In case of an update, check if the key has been updated as it should be
if ('update' === $operation) {
if (self::isKeyUpdated($response, $apiKey)) {
return;
return $response;
}
}

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

// Else try again ...
Expand Down
2 changes: 1 addition & 1 deletion templates/php/api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ use {{invokerPackage}}\Support\Helpers;
$apiKey,
$maxRetries,
$timeout,
null,
'Algolia\AlgoliaSearch\Support\Helpers::linearTimeout',
$requestOptions
);
}
Expand Down

0 comments on commit d8a9ac3

Please # to comment.