From cd41a207a10c87d61bd7ba0b962f8f6d9e9be44e Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Wed, 27 Sep 2023 09:54:47 +0200 Subject: [PATCH] IcingaRedis: Don't throw in method `isUnavailable` fixes #883 --- library/Icingadb/Common/IcingaRedis.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/library/Icingadb/Common/IcingaRedis.php b/library/Icingadb/Common/IcingaRedis.php index edce836cc..a22a0f03b 100644 --- a/library/Icingadb/Common/IcingaRedis.php +++ b/library/Icingadb/Common/IcingaRedis.php @@ -44,8 +44,12 @@ public static function isUnavailable(): bool { $self = self::instance(); - if ($self->redis === null) { - $self->getConnection(); + if (! $self->redisUnavailable && $self->redis === null) { + try { + $self->getConnection(); + } catch (Exception $_) { + // getConnection already logs the error + } } return $self->redisUnavailable;