Skip to content

Commit

Permalink
[Lock] compatiblity with redis cluster 7
Browse files Browse the repository at this point in the history
  • Loading branch information
bastnic authored and nicolas-grekas committed Mar 13, 2024
1 parent 6b550a1 commit ee5bd73
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/Symfony/Component/Lock/Store/RedisStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,10 @@ public function exists(Key $key)
private function evaluate(string $script, string $resource, array $args)
{
if (
$this->redis instanceof \Redis ||
$this->redis instanceof \RedisCluster ||
$this->redis instanceof RedisProxy ||
$this->redis instanceof RedisClusterProxy
$this->redis instanceof \Redis
|| $this->redis instanceof \RedisCluster
|| $this->redis instanceof RedisProxy
|| $this->redis instanceof RedisClusterProxy
) {
$this->redis->clearLastError();
$result = $this->redis->eval($script, array_merge([$resource], $args), 1);
Expand Down Expand Up @@ -317,7 +317,9 @@ private function getNowCode(): string
try {
$this->supportTime = 1 === $this->evaluate($script, 'symfony_check_support_time', []);
} catch (LockStorageException $e) {
if (false === strpos($e->getMessage(), 'commands not allowed after non deterministic')) {
if (!str_contains($e->getMessage(), 'commands not allowed after non deterministic')
&& !str_contains($e->getMessage(), 'is not allowed from script script')
) {
throw $e;
}
$this->supportTime = false;
Expand Down

0 comments on commit ee5bd73

Please sign in to comment.