mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 12:55:26 +01:00
Fix lock files not updated when cache is cleared race condition
This commit is contained in:
parent
3068d38c3c
commit
ff49dfca1d
@ -361,7 +361,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();
|
||||
@ -377,8 +377,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,11 +66,7 @@ class FileReferenceCacheProvider
|
||||
public function hasConfigChanged(): bool
|
||||
{
|
||||
$new_hash = $this->config->computeHash();
|
||||
$has_changed = $new_hash !== $this->getConfigHashCache();
|
||||
if ($has_changed) {
|
||||
$this->setConfigHashCache($new_hash);
|
||||
}
|
||||
return $has_changed;
|
||||
return $new_hash !== $this->getConfigHashCache();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1000,7 +996,7 @@ class FileReferenceCacheProvider
|
||||
return false;
|
||||
}
|
||||
|
||||
public function setConfigHashCache(string $hash): void
|
||||
public function setConfigHashCache(string $hash = ''): void
|
||||
{
|
||||
$cache_directory = Config::getInstance()->getCacheDirectory();
|
||||
|
||||
@ -1008,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…
Reference in New Issue
Block a user