Skip to content

Commit

Permalink
Merge pull request #232 from matomo-org/149-fix-test-command
Browse files Browse the repository at this point in the history
Added code to skip maxmemory config check when --skip-max-memory-config-check=1, #149
  • Loading branch information
snake14 authored Mar 3, 2024
2 parents fa2f39c + 9c9f1da commit 77a2e3e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Commands/Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class Test extends ConsoleCommand
protected function configure()
{
$this->setName('queuedtracking:test');
$this->addRequiredValueOption('skip-max-memory-config-check', null, 'Do not check for MaxMemory config values ');
$this->setDescription('Test your Redis connection get some information about your current system.');
}

Expand All @@ -48,10 +49,13 @@ protected function configure()

protected function doExecute(): int
{
$input = $this->getInput();
$output = $this->getOutput();
$trackerEnvironment = new Environment('tracker');
$trackerEnvironment->init();

$shouldSkipCheckingMemoryConfigValues = $input->getOption('skip-max-memory-config-check');

$settings = Queue\Factory::getSettings();
$isUsingRedis = $settings->isRedisBackend();

Expand Down Expand Up @@ -102,7 +106,7 @@ protected function doExecute(): int
$output->writeln('Memory: ' . var_export($backend->getMemoryStats(), 1));

$redis = $backend->getConnection();
if ($isUsingRedis) {
if ($isUsingRedis && !$shouldSkipCheckingMemoryConfigValues) {

$evictionPolicy = $this->getRedisConfig($redis, 'maxmemory-policy');
$output->writeln('MaxMemory Eviction Policy config: ' . $evictionPolicy);
Expand Down

0 comments on commit 77a2e3e

Please sign in to comment.