From 86463c23c187dd4cc393da98a5021fb61ea80e3d Mon Sep 17 00:00:00 2001 From: Pavlo Yatsukhnenko Date: Mon, 3 Jun 2024 12:28:07 +0300 Subject: [PATCH 1/2] Fix Predis cluster flush --- includes/class-predis.php | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/includes/class-predis.php b/includes/class-predis.php index 8f2f55f3..e3ccbb06 100644 --- a/includes/class-predis.php +++ b/includes/class-predis.php @@ -139,11 +139,10 @@ public function connect( $read_timeout = null ) { * @return bool */ public function flush( $throw_exception = false ) { - $flush_timeout = defined( 'WP_REDIS_FLUSH_TIMEOUT' ) - ? intval( WP_REDIS_FLUSH_TIMEOUT ) - : 5; - if ( is_null( $this->redis ) ) { + $flush_timeout = defined( 'WP_REDIS_FLUSH_TIMEOUT' ) + ? intval( WP_REDIS_FLUSH_TIMEOUT ) + : 5; try { $this->connect( $flush_timeout ); } catch ( Exception $exception ) { @@ -153,16 +152,16 @@ public function flush( $throw_exception = false ) { return false; } - } - if ( is_null( $this->redis ) ) { - return false; + if ( is_null( $this->redis ) ) { + return false; + } } if ( defined( 'WP_REDIS_CLUSTER' ) ) { try { - foreach ( $this->redis->_masters() as $master ) { - $this->redis->flushdb( $master ); + foreach ( $this->redis->getIterator() as $master ) { + $master->flushdb(); } } catch ( Exception $exception ) { if ( $throw_exception ) { From d82f436c0e4077150d4ec2a10e85bdac9a0cd7ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Till=20Kr=C3=BCss?= Date: Mon, 10 Jun 2024 13:15:42 -0700 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3804d85c..efb65633 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## Unreleased -- Fixed issues with Predis and replication connections +- Fixed several issues with Predis and cluster/replicated connection - Fixed rare fatal error in `show_error_and_die()` (one more time) ## 2.5.2