Warnings on reports page

Created on 19 September 2023, about 1 year ago
Updated 16 August 2024, 3 months ago

Problem/Motivation

Check for config empty scenarios on $memory_config['maxmemory']

Steps to reproduce

i guess empty the config values

Proposed resolution

diff --git a/src/Controller/ReportController.php b/src/Controller/ReportController.php
index 9ff362a071df04340db97c0e050839f25c23536f..037e636051f15a03f71779085ccd0158c152a5eb 100644
--- a/src/Controller/ReportController.php
+++ b/src/Controller/ReportController.php
@@ -169,7 +169,7 @@ class ReportController extends ControllerBase {
$end = microtime(TRUE);
$memory_config = $this->redis->config('get', 'maxmemory*');

- if ($memory_config['maxmemory']) {
+ if (!empty($memory_config['maxmemory'])) {
$memory_value = $this->t('@used_memory / @max_memory (@used_percentage%), maxmemory policy: @policy', [
'@used_memory' => $info['used_memory_human'] ?? $info['Memory']['used_memory_human'],
'@max_memory' => format_size($memory_config['maxmemory']),
@@ -180,7 +180,7 @@ class ReportController extends ControllerBase {
else {
$memory_value = $this->t('@used_memory / unlimited, maxmemory policy: @policy', [
'@used_memory' => $info['used_memory_human'] ?? $info['Memory']['used_memory_human'],
- '@policy' => $memory_config['maxmemory-policy'],
+ '@policy' => $memory_config['maxmemory-policy'] ?? NULL,
]);
}

@@ -248,7 +248,7 @@ class ReportController extends ControllerBase {
];

// Warnings/hints.
- if ($memory_config['maxmemory-policy'] == 'noeviction') {
+ if (!empty($memory_config['maxmemory-policy']) && $memory_config['maxmemory-policy'] == 'noeviction') {
$redis_url = Url::fromUri('https://redis.io/topics/lru-cache', [
'fragment' => 'eviction-policies',
'attributes' => [

πŸ› Bug report
Status

Closed: duplicate

Version

1.7

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States pramodganore

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @pramodganore
  • πŸ‡ΊπŸ‡ΈUnited States pramodganore

    This patch was already added to our project, tyring to get rid of patches by checking if this can be approved to merge into latest release.
    Needs review

  • First commit to issue fork.
  • Status changed to Closed: duplicate 3 months ago
  • πŸ‡¨πŸ‡­Switzerland berdir Switzerland

    This was already addressed in other issues, nothing meaningful left of the patch when applying manually.

Production build 0.71.5 2024