Skip to content

Commit

Permalink
chore: try tcp check
Browse files Browse the repository at this point in the history
  • Loading branch information
loks0n committed Oct 22, 2024
1 parent 899f3d4 commit a787ca1
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions app/http.php
Original file line number Diff line number Diff line change
Expand Up @@ -832,8 +832,9 @@ function cleanUp(Orchestration $orchestration, Table $activeRuntimes, array $net
->inject('response')
->inject('request')
->inject('log')
->inject('orchestration')
->action(
function (string $runtimeId, ?string $payload, string $path, string $method, mixed $headers, int $timeout, string $image, string $source, string $entrypoint, mixed $variables, float $cpus, int $memory, string $version, string $runtimeEntrypoint, bool $logging, string $restartPolicy, Table $activeRuntimes, Response $response, Request $request, Log $log) {
function (string $runtimeId, ?string $payload, string $path, string $method, mixed $headers, int $timeout, string $image, string $source, string $entrypoint, mixed $variables, float $cpus, int $memory, string $version, string $runtimeEntrypoint, bool $logging, string $restartPolicy, Table $activeRuntimes, Response $response, Request $request, Log $log, Orchestration $orchestration) {
if (empty($payload)) {
$payload = '';
}
Expand Down Expand Up @@ -1243,7 +1244,16 @@ function (string $runtimeId, ?string $payload, string $path, string $method, mix
throw new Exception('Function timed out during cold start.', 400);
}

$online = $validator->isValid($hostname . ':' . 3000);
$output = '';

$status = $orchestration->execute(
name: $runtimeName,
command: ['bash', '-c', '>/dev/tcp/localhost/3000'],
output: $output,
timeout: $timeout
);

$online = $status === 0;
if ($online) {
break;
}
Expand Down

0 comments on commit a787ca1

Please sign in to comment.