Skip to content

Commit

Permalink
Updated verbosity and logic attempts.
Browse files Browse the repository at this point in the history
  • Loading branch information
rennokki committed Mar 24, 2021
1 parent ebf669d commit 09bded9
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions app/Commands/WatchNetworkCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,20 +99,22 @@ protected function checkPod(K8sPod $pod, int $memoryThreshold, string $probesTok
$rejectsNewConnections = $pod->getLabel('echo.soketi.app/rejects-new-connections', 'no');
$dateTime = now()->toDateTimeString();

$this->line("[{$dateTime}] Current memory usage is {$memoryUsagePercentage}%. Checking...", null, 'v');

if ($memoryUsagePercentage >= $memoryThreshold) {
if ($rejectsNewConnections === 'no') {
$this->info("[{$dateTime}] Pod now rejects connections.");
$this->info("[{$dateTime}] Pod uses {$memoryUsagePercentage}, threshold is {$memoryThreshold}.");
}
$this->info("[{$dateTime}] Echo container uses {$memoryUsagePercentage}%, threshold is {$memoryThreshold}%");

$this->rejectNewConnections($pod, $probesToken, $echoAppPort);
$this->rejectNewConnections($pod, $probesToken, $echoAppPort);
}
} else {
if ($rejectsNewConnections === 'yes') {
$this->info("[{$dateTime}] Pod now accepts connections (memory usage: {$memoryUsagePercentage}% RAM used.");
$this->info("[{$dateTime}] Pod uses {$memoryUsagePercentage}, threshold is {$memoryThreshold}.");
}
$this->info("[{$dateTime}] Pod now accepts connections.");
$this->info("[{$dateTime}] Echo container uses {$memoryUsagePercentage}%, threshold is {$memoryThreshold}%");

$this->acceptNewConnections($pod, $probesToken, $echoAppPort);
$this->acceptNewConnections($pod, $probesToken, $echoAppPort);
}
}
}

Expand Down

0 comments on commit 09bded9

Please sign in to comment.