Skip to content

Commit

Permalink
Implement review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
dciprian-petrisor committed Oct 22, 2024
1 parent b79658b commit a447007
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/Symfony/Component/Lock/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ CHANGELOG

* RedisStore uses `EVALSHA` over `EVAL` when evaluating LUA scripts
* Add `NullStore`

7.0
---

Expand Down
8 changes: 4 additions & 4 deletions src/Symfony/Component/Lock/Store/RedisStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ private function evaluate(string $script, string $resource, array $args): mixed
$this->redis->clearLastError();

$result = $this->redis->evalSha($scriptSha, array_merge([$resource], $args), 1);
if (null !== ($err = $this->redis->getLastError()) && self::NO_SCRIPT_ERROR_MESSAGE === $err) {
if (self::NO_SCRIPT_ERROR_MESSAGE === $err = $this->redis->getLastError()) {
$this->redis->clearLastError();

if ($this->redis instanceof \RedisCluster) {
Expand All @@ -245,7 +245,7 @@ private function evaluate(string $script, string $resource, array $args): mixed
$this->redis->script('LOAD', $script);
}

if (null !== ($err = $this->redis->getLastError())) {
if (null !== $err = $this->redis->getLastError()) {
throw new LockStorageException($err);
}

Expand All @@ -263,12 +263,12 @@ private function evaluate(string $script, string $resource, array $args): mixed
$client = $this->redis->_instance($this->redis->_target($resource));
$client->clearLastError();
$result = $client->evalSha($scriptSha, array_merge([$resource], $args), 1);
if (null !== ($err = $client->getLastError()) && self::NO_SCRIPT_ERROR_MESSAGE === $err) {
if (self::NO_SCRIPT_ERROR_MESSAGE === $err = $client->getLastError()) {
$client->clearLastError();

$client->script('LOAD', $script);

if (null !== ($err = $client->getLastError())) {
if (null !== $err = $client->getLastError()) {
throw new LockStorageException($err);
}

Expand Down

0 comments on commit a447007

Please sign in to comment.