From 6ced607f2a299a32d58d6fcea39ea85738d15a03 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 13 Oct 2023 15:16:52 +0200 Subject: [PATCH] fix: timeout for instant remote processes --- app/Models/Server.php | 3 +-- bootstrap/helpers/remoteProcess.php | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Models/Server.php b/app/Models/Server.php index 8b1ebc976..fa8fdbe39 100644 --- a/app/Models/Server.php +++ b/app/Models/Server.php @@ -124,8 +124,7 @@ class Server extends BaseModel return $this->destinations()->map(function ($standaloneDocker) { $postgresqls = $standaloneDocker->postgresqls; $redis = $standaloneDocker->redis; - return $postgresqls->merge($redis); - // return $postgresqls?->concat([]) ?? collect([]); + return $postgresqls->concat($redis); })->flatten(); } public function applications() diff --git a/bootstrap/helpers/remoteProcess.php b/bootstrap/helpers/remoteProcess.php index b32db5b2c..25a6d2db7 100644 --- a/bootstrap/helpers/remoteProcess.php +++ b/bootstrap/helpers/remoteProcess.php @@ -108,12 +108,13 @@ function generateSshCommand(Server $server, string $command, bool $isMux = true) } function instant_remote_process(Collection|array $command, Server $server, $throwError = true) { + $timeout = config('constants.ssh.command_timeout'); if ($command instanceof Collection) { $command = $command->toArray(); } $command_string = implode("\n", $command); $ssh_command = generateSshCommand($server, $command_string); - $process = Process::run($ssh_command); + $process = Process::timeout($timeout)->run($ssh_command); $output = trim($process->output()); $exitCode = $process->exitCode(); if ($exitCode !== 0) {