]> source.dussan.org Git - nextcloud-server.git/commitdiff
Make sure the cache is only reset once at a time 17543/head
authorJulius Härtl <jus@bitgrid.net>
Tue, 15 Oct 2019 09:56:27 +0000 (11:56 +0200)
committerJulius Härtl <jus@bitgrid.net>
Tue, 15 Oct 2019 13:17:16 +0000 (15:17 +0200)
Signed-off-by: Julius Härtl <jus@bitgrid.net>
lib/private/Template/SCSSCacher.php

index 1ddb4ff59ddd949d7c120cc342fab26e2e0a5e9d..c6d5fc8ef7149e920bfc5f622bfcbbc18c1dd7bd 100644 (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');
        }
 
        /**