From 94da3c775a75a60b0d7ba143873b12b55390593a Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Wed, 6 Nov 2024 20:07:37 +0100 Subject: [PATCH] Remove predis scan workaround since it's now covered by symfony/cache --- CHANGELOG.md | 17 +++++++++++++++++ composer.json | 2 +- src/Cache/ShlinkPredisClient.php | 18 ------------------ 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9364268..ee41ec3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,23 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com), and this project adheres to [Semantic Versioning](https://semver.org). +## [Unreleased] +### Added +* *Nothing* + +### Changed +* Remove predis scan workaround by requiring `symfony/cache` 7.1.7, which fixes it. + +### Deprecated +* *Nothing* + +### Removed +* *Nothing* + +### Fixed +* *Nothing* + + ## [6.5.0] - 2024-11-03 ### Added * *Nothing* diff --git a/composer.json b/composer.json index 6b8a293..e9ce777 100644 --- a/composer.json +++ b/composer.json @@ -32,7 +32,7 @@ "ramsey/uuid": "^4.7", "shlinkio/shlink-config": "^3.3", "shlinkio/shlink-json": "^1.2", - "symfony/cache": "^7.1", + "symfony/cache": "^7.1.7", "symfony/lock": "^7.1", "symfony/mercure": "^0.6", "symfony/string": "^7.1", diff --git a/src/Cache/ShlinkPredisClient.php b/src/Cache/ShlinkPredisClient.php index 91d08b6..bd0e2a1 100644 --- a/src/Cache/ShlinkPredisClient.php +++ b/src/Cache/ShlinkPredisClient.php @@ -8,7 +8,6 @@ use Predis\ClientInterface; use Predis\Connection\Replication\ReplicationInterface; -use function array_key_exists; use function class_alias; // This file is a fix for https://github.com/shlinkio/shlink/issues/1684, until symfony/cache supports predis 2 @@ -21,21 +20,4 @@ public function getClientFor(string $name): ClientInterface { return parent::getClientBy('role', $name); } - - public function __call($commandID, $arguments) - { - // Work around the incompatibility of SCAN with `null` cursor when using Redis 7.4, by defaulting to 0 instead. - // The `$predisClient->scan(null, ...)` call happens in Symfony cache. See https://github.com/symfony/symfony/issues/58660 - // Using `0` instead of `null` works for older versions too. - // - // This workaround should be temporary, but it's still to be determined if this should be fixed in symfony/cache - // side or predis side. - // - // The cursor is the first argument (index 0) - if ($commandID === 'scan' && array_key_exists(0, $arguments) && $arguments[0] === null) { - $arguments[0] = 0; - } - - return parent::__call($commandID, $arguments); // TODO: Change the autogenerated stub - } }