[Cache] fail gracefully when locking is not supported
This commit is contained in:
parent
3ab7d57659
commit
93485190f9
@ -90,8 +90,10 @@ final class LockRegistry
|
|||||||
while (true) {
|
while (true) {
|
||||||
try {
|
try {
|
||||||
// race to get the lock in non-blocking mode
|
// race to get the lock in non-blocking mode
|
||||||
if (flock($lock, LOCK_EX | LOCK_NB)) {
|
$locked = flock($lock, LOCK_EX | LOCK_NB, $wouldBlock);
|
||||||
$logger && $logger->info('Lock acquired, now computing item "{key}"', ['key' => $item->getKey()]);
|
|
||||||
|
if ($locked || !$wouldBlock) {
|
||||||
|
$logger && $logger->info(sprintf('Lock %s, now computing item "{key}"', $locked ? 'acquired' : 'not supported'), ['key' => $item->getKey()]);
|
||||||
self::$lockedFiles[$key] = true;
|
self::$lockedFiles[$key] = true;
|
||||||
|
|
||||||
$value = $callback($item, $save);
|
$value = $callback($item, $save);
|
||||||
|
Reference in New Issue
Block a user