From 3327a008fa330f723d45b80f8972cd662e4fe4d2 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Wed, 15 Nov 2023 23:23:17 -0700 Subject: [PATCH 1/2] Update HashtagService, improve count perf --- app/Services/HashtagService.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Services/HashtagService.php b/app/Services/HashtagService.php index 81a7ae4ed..d3cfb2743 100644 --- a/app/Services/HashtagService.php +++ b/app/Services/HashtagService.php @@ -29,8 +29,9 @@ class HashtagService public static function count($id) { - return Cache::remember('services:hashtag:public-count:by_id:' . $id, 86400, function() use($id) { - return StatusHashtag::whereHashtagId($id)->whereStatusVisibility('public')->count(); + return Cache::remember('services:hashtag:public-count:by_id:' . $id, 3600, function() use($id) { + $tag = Hashtag::find($id); + return $tag ? $tag->cached_count ?? 0 : 0; }); } From e1b39bcf6feaa193acb2cd7117991b665b348de3 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Wed, 15 Nov 2023 23:24:32 -0700 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2bc197ff5..f130ce819 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,6 +51,9 @@ - Update mail config ([0e431271](https://github.com/pixelfed/pixelfed/commit/0e431271)) - Update hashtag following ([015b1b80](https://github.com/pixelfed/pixelfed/commit/015b1b80)) - Update IncrementPostCount job, prevent overlap ([b2c9cc23](https://github.com/pixelfed/pixelfed/commit/b2c9cc23)) +- Update HashtagFollowService, fix cache invalidation bug ([84f4e885](https://github.com/pixelfed/pixelfed/commit/84f4e885)) +- Update Experimental Home Feed, fix remote posts, shares and reblogs ([c6a6b3ae](https://github.com/pixelfed/pixelfed/commit/c6a6b3ae)) +- Update HashtagService, improve count perf ([3327a008](https://github.com/pixelfed/pixelfed/commit/3327a008)) - ([](https://github.com/pixelfed/pixelfed/commit/)) ## [v0.11.9 (2023-08-21)](https://github.com/pixelfed/pixelfed/compare/v0.11.8...v0.11.9)