Skip to content

Commit

Permalink
Merge pull request #43247 from nextcloud/enh/noid/load-non-lazy-confi…
Browse files Browse the repository at this point in the history
…g-value

[IAppConfig] returns non lazy value while searching for lazy one
  • Loading branch information
ArtificialOwl authored Feb 6, 2024
2 parents bdb450f + 8ba2cd4 commit 5238b1c
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions lib/private/AppConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -462,11 +462,14 @@ private function getTypedValue(
throw new AppConfigTypeConflictException('conflict with value type from database');
}

if ($lazy) {
return $this->lazyCache[$app][$key] ?? $default;
}

return $this->fastCache[$app][$key] ?? $default;
/**
* - the pair $app/$key cannot exist in both array,
* - we should still returns an existing non-lazy value even if current method
* is called with $lazy is true
*
* This way, lazyCache will be empty until the load for lazy config value is requested.
*/
return $this->lazyCache[$app][$key] ?? $this->fastCache[$app][$key] ?? $default;
}

/**
Expand Down

0 comments on commit 5238b1c

Please sign in to comment.