mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 13:51:54 +01:00
Merge pull request #8714 from kkmuffme/dont-rewrite-config-hash-to-cache-when-unchanged
Fix cache race condition due to missing repopulation of lock files cache
This commit is contained in:
commit
4e17585093
@ -369,7 +369,7 @@ class ProjectAnalyzer
|
||||
}
|
||||
|
||||
if ($this->file_reference_provider->cache) {
|
||||
$this->file_reference_provider->cache->hasConfigChanged();
|
||||
$this->file_reference_provider->cache->setConfigHashCache();
|
||||
}
|
||||
|
||||
$this->project_cache_provider->updateComposerLockHash();
|
||||
@ -385,8 +385,10 @@ class ProjectAnalyzer
|
||||
Config::removeCacheDirectory($cache_directory);
|
||||
}
|
||||
|
||||
$this->file_reference_provider->cache->setConfigHashCache();
|
||||
|
||||
if ($this->project_cache_provider) {
|
||||
$this->project_cache_provider->hasLockfileChanged();
|
||||
$this->project_cache_provider->updateComposerLockHash();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -66,9 +66,7 @@ class FileReferenceCacheProvider
|
||||
public function hasConfigChanged(): bool
|
||||
{
|
||||
$new_hash = $this->config->computeHash();
|
||||
$has_changed = $new_hash !== $this->getConfigHashCache();
|
||||
$this->setConfigHashCache($new_hash);
|
||||
return $has_changed;
|
||||
return $new_hash !== $this->getConfigHashCache();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -998,7 +996,7 @@ class FileReferenceCacheProvider
|
||||
return false;
|
||||
}
|
||||
|
||||
public function setConfigHashCache(string $hash): void
|
||||
public function setConfigHashCache(string $hash = ''): void
|
||||
{
|
||||
$cache_directory = Config::getInstance()->getCacheDirectory();
|
||||
|
||||
@ -1006,6 +1004,10 @@ class FileReferenceCacheProvider
|
||||
return;
|
||||
}
|
||||
|
||||
if ($hash === '') {
|
||||
$hash = $this->config->computeHash();
|
||||
}
|
||||
|
||||
if (!is_dir($cache_directory)) {
|
||||
try {
|
||||
if (mkdir($cache_directory, 0777, true) === false) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user