Skip to content

Commit

Permalink
Clear cached app config while waiting for the SCSSCache lock to return
Browse files Browse the repository at this point in the history
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
  • Loading branch information
MorrisJobke committed Oct 15, 2020
1 parent 87f8a09 commit 0c9d6da
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/private/AllConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,16 @@ public function deleteAppValue($appName, $key) {
\OC::$server->query(\OC\AppConfig::class)->deleteKey($appName, $key);
}

/**
* Clear all the cached app config values
*
* WARNING: do not use this - this is only for usage with the SCSSCacher to
* clear the memory cache of the app config
*/
public function clearCachedAppConfig() {
\OC::$server->query(\OC\AppConfig::class)->clearCachedConfig();
}

/**
* Removes all keys in appconfig belonging to the app
*
Expand Down
10 changes: 10 additions & 0 deletions lib/private/AppConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -344,4 +344,14 @@ protected function loadConfigValues() {

$this->configLoaded = true;
}

/**
* Clear all the cached app config values
*
* WARNING: do not use this - this is only for usage with the SCSSCacher to
* clear the memory cache of the app config
*/
public function clearCachedConfig() {
$this->configLoaded = false;
}
}
1 change: 1 addition & 0 deletions lib/private/Template/SCSSCacher.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ public function process(string $root, string $file, string $app): bool {
$retry = 0;
sleep(1);
while ($retry < 10) {
$this->config->clearCachedAppConfig();
if (!$this->variablesChanged() && $this->isCached($fileNameCSS, $app)) {
// Inject icons vars css if any
$this->lockingCache->remove($lockKey);
Expand Down
13 changes: 13 additions & 0 deletions lib/public/IConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,4 +257,17 @@ public function deleteAppFromAllUsers($appName);
* @since 8.0.0
*/
public function getUsersForUserValue($appName, $key, $value);


/**
* Clear all the cached app config values
*
* WARNING: do not use this - this is only for usage with the SCSSCacher to
* clear the memory cache of the app config
*
* @internal
* @since 21.0.0
* @deprecated 21.0.0
*/
public function clearCachedAppConfig();
}

0 comments on commit 0c9d6da

Please sign in to comment.