Skip to content

Commit 420d996

Browse files
committed
[Lock] Fallback to eval when LOAD fails due to missing script
1 parent a389683 commit 420d996

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Symfony/Component/Lock/Store/RedisStore.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,13 @@ private function evaluate(string $script, string $resource, array $args): mixed
294294
}
295295
}
296296

297-
$this->handlePredisError(fn () => $this->redis->script('LOAD', $script));
297+
if ($this->redis->getConnection() instanceof \Predis\Connection\Cluster\ClusterInterface) {
298+
foreach ($this->redis as $connection) {
299+
$this->handlePredisError(fn () => $connection->script('LOAD', $script));
300+
}
301+
} else {
302+
$this->handlePredisError(fn () => $this->redis->script('LOAD', $script));
303+
}
298304

299305
return $this->handlePredisError(fn () => $this->redis->evalSha($scriptSha, 1, $resource, ...$args));
300306
}

0 commit comments

Comments
 (0)