Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: runtime ready loop #115

Merged
merged 11 commits into from
Oct 23, 2024
Merged
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions app/http.php
Original file line number Diff line number Diff line change
Expand Up @@ -965,16 +965,21 @@ function (string $runtimeId, ?string $payload, string $path, string $method, mix
if ($errNo === 0) {
$body = \json_decode($executorResponse, true);

// If the runtime has not yet attempted to start, it will return 500
if ($statusCode >= 500) {
$error = $body['message'];
// Continues to retry logic
} elseif ($statusCode >= 400) {

// If the runtime fails to start, it will return 400, except for 409
// which indicates that the runtime is already being created
} elseif ($statusCode >= 400 && $statusCode !== 409) {
$error = $body['message'];
throw new Exception('An internal curl error has occurred while starting runtime! Error Msg: ' . $error, 500);
} else {
break;
}
} elseif ($errNo !== 111) { // Connection Refused - see https://openswoole.com/docs/swoole-error-code

// Connection refused - see https://openswoole.com/docs/swoole-error-code
} elseif ($errNo !== 111) {
throw new Exception('An internal curl error has occurred while starting runtime! Error Msg: ' . $error, 500);
}

Expand Down
Loading