From f0bc9d66e4cac54464e1607a31f90de50486a11d Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 16 Sep 2025 03:27:58 -0600 Subject: [PATCH 1/2] Update InstanceService, fix total post count when config_cache is disabled --- app/Services/InstanceService.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/app/Services/InstanceService.php b/app/Services/InstanceService.php index 0a6255ad2..85ffe714a 100644 --- a/app/Services/InstanceService.php +++ b/app/Services/InstanceService.php @@ -4,7 +4,8 @@ namespace App\Services; use App\Instance; use App\Util\Blurhash\Blurhash; -use Cache; +use Illuminate\Support\Facades\Cache; +use Illuminate\Support\Facades\DB; class InstanceService { @@ -100,7 +101,17 @@ class InstanceService public static function totalLocalStatuses() { - return config_cache('instance.stats.total_local_posts'); + if (config('instance.enable_cc')) { + return config_cache('instance.stats.total_local_posts'); + } + + return Cache::remember(self::CACHE_KEY_TOTAL_POSTS, now()->addHour(), function () { + return DB::table('statuses') + ->whereNull('deleted_at') + ->where('local', true) + ->whereNot('type', 'share') + ->count(); + }); } public static function headerBlurhash() From 597b285f1d5b728df2b7dce73ffbdabfda0033b2 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 16 Sep 2025 03:28:50 -0600 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 23a42ad1b..49b906cfe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Update Status storage, add SanitizerService to fix spacing in html stripped content ([3686c9212](https://github.com/pixelfed/pixelfed/commit/3686c9212)) - Update app config, add description and rule env variables ([0980519a9](https://github.com/pixelfed/pixelfed/commit/0980519a9)) +- Update InstanceService, fix total post count when config_cache is disabled ([f0bc9d66e](https://github.com/pixelfed/pixelfed/commit/f0bc9d66e)) - ([](https://github.com/pixelfed/pixelfed/commit/)) ## [v0.12.6 (2025-09-03)](https://github.com/pixelfed/pixelfed/compare/v0.12.6...dev)