Skip to content

Commit

Permalink
in high concurrency situations, with slow filesystems one request mig…
Browse files Browse the repository at this point in the history
…ht delete (try to refresh) the cache entry after the file_exists check passed.

this will result in a file not found error when including the file. to avoid such situations we ignore this type of errors
  • Loading branch information
goetas committed Aug 4, 2021
1 parent b5c5254 commit 5843fe5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Cache/FileCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function __construct(string $dir)
public function load(string $class): ?ClassMetadata
{
$path = $this->getCachePath($class);
if (!file_exists($path)) {
if (!is_readable($path)) {
return null;
}

Expand All @@ -35,7 +35,7 @@ public function load(string $class): ?ClassMetadata
return $metadata;
}
// if the file does not return anything, the return value is integer `1`.
} catch (\ParseError $e) {
} catch (\Error $e) {
// ignore corrupted cache
}

Expand Down

0 comments on commit 5843fe5

Please sign in to comment.