Skip to content

Commit 5442975

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

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

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

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

297-
$this->handlePredisError(fn () => $this->redis->script('LOAD', $script));
297+
try {
298+
$this->handlePredisError(fn () => $this->redis->script('LOAD', $script));
298299

299-
return $this->handlePredisError(fn () => $this->redis->evalSha($scriptSha, 1, $resource, ...$args));
300+
return $this->handlePredisError(fn () => $this->redis->evalSha($scriptSha, 1, $resource, ...$args));
301+
} catch (\Predis\NotSupportedException) {
302+
// If 'script LOAD' isn't supported, fallback to eval
303+
return $this->redis->eval(...array_merge([$script, 1, $resource], $args));
304+
}
300305
}
301306

302307
private function getUniqueToken(Key $key): string

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy