From a787ca188ea3f1cd026b3213e8e5b264bbd1952b Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Tue, 22 Oct 2024 14:53:17 +0100 Subject: [PATCH] chore: try tcp check --- app/http.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/http.php b/app/http.php index a5b6465..0d86121 100644 --- a/app/http.php +++ b/app/http.php @@ -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 = ''; } @@ -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; }