Always detect connection on report page

Created on 11 August 2022, over 2 years ago
Updated 7 June 2023, almost 2 years ago

Problem/Motivation

In some situations the redis report page will report the redis connection isn't properly configured when it is. This because the check it uses require the redis connection to be started prior to the report logic. Generally this is a sane assumption but it can fail if you have caches disabled in a local environment or maybe if you have some sort of chained cache with apc/memcache that doesn't always hit redis.

Steps to reproduce

The easiest way to test this is to just configure the redis connection but leave the default cache configured to the database.

Proposed resolution

Request an actual client on the report page to see if the connection is properly configured.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Needs work

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States neclimdul Houston, TX

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡¨πŸ‡¦Canada joelpittet Vancouver

    This seems to work like a charm, I followed the steps to reproduce and it shows it connected even without cache bin.

    Note it does fail to apply if ✨ Allow failing over to database or other backends if Redis is down RTBC is applied, so might need to re-roll that after this is in.

  • Status changed to Needs work almost 2 years ago
  • πŸ‡¨πŸ‡­Switzerland berdir Switzerland
    +++ b/src/Client/PhpRedis.php
    @@ -25,11 +24,17 @@ class PhpRedis implements ClientInterface {
         }
     
    -    if ($persistent) {
    -      $client->pconnect($host, $port);
    +    try {
    +      if ($persistent) {
    +        $client->pconnect($host, $port);
    +      }
    +      else {
    +        $client->connect($host, $port);
    +      }
         }
    -    else {
    -      $client->connect($host, $port);
    

    The relay client is the same, so that should be updated now as well to be kept in sync.

Production build 0.71.5 2024