Skip to content

Commit

Permalink
Remove predis scan workaround since it's now covered by symfony/cache
Browse files Browse the repository at this point in the history
  • Loading branch information
acelaya committed Nov 6, 2024
1 parent 8b82404 commit 94da3c7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 19 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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*
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
18 changes: 0 additions & 18 deletions src/Cache/ShlinkPredisClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}
}

0 comments on commit 94da3c7

Please sign in to comment.