Skip to content

Commit ee6d96d

Browse files
committed
Merge branch '7.2' into 7.3
* 7.2: [Lock] Fallback to `eval` when `LOAD` fails due to missing script
2 parents 9cc322e + 02a3863 commit ee6d96d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Store/RedisStore.php

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

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

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

0 commit comments

Comments
 (0)