Make sure the cache is only reset once at a time

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2019-10-15 11:56:27 +02:00
parent e51010b0f4
commit ee743867d4
No known key found for this signature in database
GPG Key ID: 4C614C6ED2CDE6DF
1 changed files with 5 additions and 1 deletions

View File

@ -269,8 +269,8 @@ class SCSSCacher {
private function variablesChanged(): bool {
$injectedVariables = $this->getInjectedVariables();
if ($this->config->getAppValue('core', 'theming.variables') !== md5($injectedVariables)) {
$this->resetCache();
$this->config->setAppValue('core', 'theming.variables', md5($injectedVariables));
$this->resetCache();
return true;
}
return false;
@ -364,6 +364,9 @@ class SCSSCacher {
* We need to regenerate all files when variables change
*/
public function resetCache() {
if (!$this->lockingCache->add('resetCache', 'locked!', 120)) {
return;
}
$this->injectedVariables = null;
// do not clear locks
@ -381,6 +384,7 @@ class SCSSCacher {
}
}
$this->logger->debug('SCSSCacher: css cache cleared!');
$this->lockingCache->remove('resetCache');
}
/**