Skip to content

Commit

Permalink
bug #44820 [Cache] Don't lock when doing nested computations (nicolas…
Browse files Browse the repository at this point in the history
…-grekas)

This PR was merged into the 4.4 branch.

Discussion
----------

[Cache] Don't lock when doing nested computations

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #41130
| License       | MIT
| Doc PR        | -

Commits
-------

be8cbd2 [Cache] Don't lock when doing nested computations
  • Loading branch information
nicolas-grekas committed Dec 28, 2021
2 parents 9d8638c + be8cbd2 commit 8a1c932
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Symfony/Component/Cache/LockRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public static function compute(callable $callback, ItemInterface $item, bool &$s

$key = self::$files ? abs(crc32($item->getKey())) % \count(self::$files) : -1;

if ($key < 0 || (self::$lockedFiles[$key] ?? false) || !$lock = self::open($key)) {
if ($key < 0 || self::$lockedFiles || !$lock = self::open($key)) {
return $callback($item, $save);
}

Expand Down

0 comments on commit 8a1c932

Please sign in to comment.