mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-23 06:51:27 +00:00
Update ConfigCacheService, fix database race condition and fallback to file config and enable by default
This commit is contained in:
parent
cbf996c9b6
commit
60a62b59c9
3 changed files with 133 additions and 129 deletions
|
@ -67,7 +67,7 @@ ADMIN_DOMAIN="${APP_DOMAIN}"
|
|||
# @default "false"
|
||||
# @see https://docs.pixelfed.org/technical-documentation/config/#config_cache
|
||||
# @dottie/validate required,boolean
|
||||
ENABLE_CONFIG_CACHE="false"
|
||||
ENABLE_CONFIG_CACHE="true"
|
||||
|
||||
# Enable/disable new local account registrations.
|
||||
#
|
||||
|
|
|
@ -8,7 +8,7 @@ OPEN_REGISTRATION="false"
|
|||
ENFORCE_EMAIL_VERIFICATION="false"
|
||||
PF_MAX_USERS="1000"
|
||||
OAUTH_ENABLED="true"
|
||||
ENABLE_CONFIG_CACHE=false
|
||||
ENABLE_CONFIG_CACHE=true
|
||||
|
||||
# Media Configuration
|
||||
PF_OPTIMIZE_IMAGES="true"
|
||||
|
|
|
@ -4,6 +4,7 @@ namespace App\Services;
|
|||
|
||||
use App\Models\ConfigCache as ConfigCacheModel;
|
||||
use Cache;
|
||||
use Illuminate\Database\QueryException;
|
||||
|
||||
class ConfigCacheService
|
||||
{
|
||||
|
@ -25,8 +26,8 @@ class ConfigCacheService
|
|||
return config($key);
|
||||
}
|
||||
|
||||
try {
|
||||
return Cache::remember($cacheKey, $ttl, function () use ($key) {
|
||||
|
||||
$allowed = [
|
||||
'app.name',
|
||||
'app.short_description',
|
||||
|
@ -175,6 +176,9 @@ class ConfigCacheService
|
|||
|
||||
return $v;
|
||||
});
|
||||
} catch (Exception | QueryException $e) {
|
||||
return config($key);
|
||||
}
|
||||
}
|
||||
|
||||
public static function put($key, $val)
|
||||
|
|
Loading…
Reference in a new issue