amazeeio / drupal-example-simple

Maintained examples can be found at https://github.com/lagoon-examples.
GNU General Public License v2.0
12 stars 21 forks source link

Redis 5 does not return PONG by default #342

Closed twerthmueller closed 5 months ago

twerthmueller commented 2 years ago

Hi

In your Redis integration, there exists a problem with Redis 5, because Redis does not return the string 'PONG' as a success message anymore.

2022-07-13 10-23-48

https://github.com/amazeeio/drupal-example-simple/blob/1aef5aa8d44f7026146611a927fa292c87b39c4d/assets/all.settings.php#L75

We should check the response in an other way:

$response = $redis->ping('PONG');
if (strpos($response, 'PONG') === false) {
   throw new \Exception('Redis could be reached but is not responding correctly.');
}

or

$response = $redis->ping();
if (!$response) {
   throw new \Exception('Redis could be reached but is not responding correctly.');
}

Currently it's possible, that many of your running Lagoon environments uses the fallback on redis-unavailable.services.yml and does not use any cache, when Redis should be enabled.

Would also nice, when the Lagoon documentation gets updated: https://docs.lagoon.sh/drupal/services/redis/

Thanks, Thomas

twerthmueller commented 2 years ago

From the Redis documentation: 2022-07-13 10-37-34

https://github.com/phpredis/phpredis/tree/5.3.4#ping

tobybellwood commented 2 years ago

Thanks, @twerthmueller - hopefully this won't catch too many people. I've updated this example, but am currently making an all-new PHP8-based one, so will ensure that works from the get-go.