remove cache
This commit is contained in:
@@ -25,19 +25,13 @@ class CleanupStaleMultiplexedConnections implements ShouldQueue
|
|||||||
|
|
||||||
private function cleanupStaleConnection(Server $server)
|
private function cleanupStaleConnection(Server $server)
|
||||||
{
|
{
|
||||||
$cacheKey = "mux_connection_{$server->id}";
|
$muxSocket = "/tmp/mux_{$server->id}";
|
||||||
$cachedConnection = cache()->get($cacheKey);
|
$checkCommand = "ssh -O check -o ControlPath=$muxSocket {$server->user}@{$server->ip} 2>/dev/null";
|
||||||
|
$checkProcess = Process::run($checkCommand);
|
||||||
|
|
||||||
if ($cachedConnection) {
|
if ($checkProcess->exitCode() !== 0) {
|
||||||
$muxSocket = $cachedConnection['muxSocket'];
|
$closeCommand = "ssh -O exit -o ControlPath=$muxSocket {$server->user}@{$server->ip} 2>/dev/null";
|
||||||
$checkCommand = "ssh -O check -o ControlPath=$muxSocket {$server->user}@{$server->ip} 2>/dev/null";
|
Process::run($closeCommand);
|
||||||
$checkProcess = Process::run($checkCommand);
|
|
||||||
|
|
||||||
if ($checkProcess->exitCode() !== 0) {
|
|
||||||
$closeCommand = "ssh -O exit -o ControlPath=$muxSocket {$server->user}@{$server->ip} 2>/dev/null";
|
|
||||||
Process::run($closeCommand);
|
|
||||||
cache()->forget($cacheKey);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user