Update ConfigCacheService, fail to fallback earlier

This commit is contained in:
Daniel Supernault 2022-04-09 22:33:14 -06:00
parent 251e455c25
commit 488561c270
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7
2 changed files with 7 additions and 0 deletions

View file

@ -39,6 +39,10 @@ class ImageOptimize implements ShouldQueue
*/ */
public function handle() public function handle()
{ {
if(config('pixelfed.optimize_image') == false) {
return;
}
$media = $this->media; $media = $this->media;
$path = storage_path('app/'.$media->media_path); $path = storage_path('app/'.$media->media_path);
if (!is_file($path) || $media->skip_optimize) { if (!is_file($path) || $media->skip_optimize) {

View file

@ -14,6 +14,9 @@ class ConfigCacheService
{ {
$cacheKey = self::CACHE_KEY . $key; $cacheKey = self::CACHE_KEY . $key;
$ttl = now()->addHours(12); $ttl = now()->addHours(12);
if(!config('instance.enable_cc')) {
return config($key);
}
return Cache::remember($cacheKey, $ttl, function() use($key) { return Cache::remember($cacheKey, $ttl, function() use($key) {