fix: timeout for instant remote processes
This commit is contained in:
parent
aaa2febef4
commit
6ced607f2a
@ -124,8 +124,7 @@ class Server extends BaseModel
|
|||||||
return $this->destinations()->map(function ($standaloneDocker) {
|
return $this->destinations()->map(function ($standaloneDocker) {
|
||||||
$postgresqls = $standaloneDocker->postgresqls;
|
$postgresqls = $standaloneDocker->postgresqls;
|
||||||
$redis = $standaloneDocker->redis;
|
$redis = $standaloneDocker->redis;
|
||||||
return $postgresqls->merge($redis);
|
return $postgresqls->concat($redis);
|
||||||
// return $postgresqls?->concat([]) ?? collect([]);
|
|
||||||
})->flatten();
|
})->flatten();
|
||||||
}
|
}
|
||||||
public function applications()
|
public function applications()
|
||||||
|
@ -108,12 +108,13 @@ function generateSshCommand(Server $server, string $command, bool $isMux = true)
|
|||||||
}
|
}
|
||||||
function instant_remote_process(Collection|array $command, Server $server, $throwError = true)
|
function instant_remote_process(Collection|array $command, Server $server, $throwError = true)
|
||||||
{
|
{
|
||||||
|
$timeout = config('constants.ssh.command_timeout');
|
||||||
if ($command instanceof Collection) {
|
if ($command instanceof Collection) {
|
||||||
$command = $command->toArray();
|
$command = $command->toArray();
|
||||||
}
|
}
|
||||||
$command_string = implode("\n", $command);
|
$command_string = implode("\n", $command);
|
||||||
$ssh_command = generateSshCommand($server, $command_string);
|
$ssh_command = generateSshCommand($server, $command_string);
|
||||||
$process = Process::run($ssh_command);
|
$process = Process::timeout($timeout)->run($ssh_command);
|
||||||
$output = trim($process->output());
|
$output = trim($process->output());
|
||||||
$exitCode = $process->exitCode();
|
$exitCode = $process->exitCode();
|
||||||
if ($exitCode !== 0) {
|
if ($exitCode !== 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user