Skip to content

Commit 09bded9

Browse files
committed
Updated verbosity and logic attempts.
1 parent ebf669d commit 09bded9

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

app/Commands/WatchNetworkCommand.php

+9-7
Original file line numberDiff line numberDiff line change
@@ -99,20 +99,22 @@ protected function checkPod(K8sPod $pod, int $memoryThreshold, string $probesTok
9999
$rejectsNewConnections = $pod->getLabel('echo.soketi.app/rejects-new-connections', 'no');
100100
$dateTime = now()->toDateTimeString();
101101

102+
$this->line("[{$dateTime}] Current memory usage is {$memoryUsagePercentage}%. Checking...", null, 'v');
103+
102104
if ($memoryUsagePercentage >= $memoryThreshold) {
103105
if ($rejectsNewConnections === 'no') {
104106
$this->info("[{$dateTime}] Pod now rejects connections.");
105-
$this->info("[{$dateTime}] Pod uses {$memoryUsagePercentage}, threshold is {$memoryThreshold}.");
106-
}
107+
$this->info("[{$dateTime}] Echo container uses {$memoryUsagePercentage}%, threshold is {$memoryThreshold}%");
107108

108-
$this->rejectNewConnections($pod, $probesToken, $echoAppPort);
109+
$this->rejectNewConnections($pod, $probesToken, $echoAppPort);
110+
}
109111
} else {
110112
if ($rejectsNewConnections === 'yes') {
111-
$this->info("[{$dateTime}] Pod now accepts connections (memory usage: {$memoryUsagePercentage}% RAM used.");
112-
$this->info("[{$dateTime}] Pod uses {$memoryUsagePercentage}, threshold is {$memoryThreshold}.");
113-
}
113+
$this->info("[{$dateTime}] Pod now accepts connections.");
114+
$this->info("[{$dateTime}] Echo container uses {$memoryUsagePercentage}%, threshold is {$memoryThreshold}%");
114115

115-
$this->acceptNewConnections($pod, $probesToken, $echoAppPort);
116+
$this->acceptNewConnections($pod, $probesToken, $echoAppPort);
117+
}
116118
}
117119
}
118120

0 commit comments

Comments
 (0)