diff --git a/src/Support/Cache.php b/src/Support/Cache.php index ef51b17..73315d3 100644 --- a/src/Support/Cache.php +++ b/src/Support/Cache.php @@ -162,27 +162,12 @@ private function withinLock(callable $callback): mixed chmod($dirPath, 0755); } - if (! is_file($lockPath)) { - touch($lockPath); - chmod($lockPath, 0666); - } - $lock = fopen($lockPath, 'c+'); if ($lock === false) { return $callback(); } - $attempts = 0; - while (! flock($lock, LOCK_EX | LOCK_NB) && $attempts < 100) { - usleep(1000); - $attempts++; - } - - if ($attempts >= 100) { - fclose($lock); - - return $callback(); - } + flock($lock, LOCK_EX); try { return $callback();