Skip to content

Commit

Permalink
chore: add sleep
Browse files Browse the repository at this point in the history
  • Loading branch information
loks0n committed Oct 29, 2024
1 parent bd70ea8 commit 4886c5c
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions app/http.php
Original file line number Diff line number Diff line change
Expand Up @@ -1274,10 +1274,18 @@ function (string $runtimeId, ?string $payload, string $path, string $method, mix
$executionRequest = $version === 'v4' ? $executeV4 : $executeV2;
do {
$executionResponse = \call_user_func($executionRequest);
} while (
\in_array($executionResponse['errNo'], [CURLE_COULDNT_RESOLVE_HOST, CURLE_COULDNT_CONNECT]) &&
(\microtime(true) - $startTime < $timeout)
);
if ($executionResponse['errNo'] === CURLE_OK) {
break;
}

// Retryable errors, runtime not ready
if (in_array($executionResponse['errNo'], [CURLE_COULDNT_RESOLVE_HOST, CURLE_COULDNT_CONNECT])) {
usleep(100000);
continue;
}

break;
} while (\microtime(true) - $startTime < $timeout);

// Error occurred
if ($executionResponse['errNo'] !== CURLE_OK) {
Expand Down

0 comments on commit 4886c5c

Please sign in to comment.