From 8a1c49090725b0e511fbec67546e897bffaefcd5 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Fri, 8 Aug 2025 14:32:46 +0800 Subject: [PATCH] :bug: Fix highlight post sometimes empty --- DysonNetwork.Sphere/Post/PostService.cs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/DysonNetwork.Sphere/Post/PostService.cs b/DysonNetwork.Sphere/Post/PostService.cs index 7bb25f3..b0e4c1e 100644 --- a/DysonNetwork.Sphere/Post/PostService.cs +++ b/DysonNetwork.Sphere/Post/PostService.cs @@ -758,15 +758,9 @@ public partial class PostService( .Take(3) .ToDictionaryAsync(e => e.PostId, e => e.Count); - var featuredPostsId = reactSocialPoints.Select(e => e.Key).ToList(); + featuredIds = reactSocialPoints.Select(e => e.Key).ToList(); - await cache.SetAsync(FeaturedPostCacheKey, featuredPostsId, TimeSpan.FromMinutes(5)); - } - - if (featuredIds is null) - { - logger.LogWarning("Failed to load featured post IDs from cache and the database is empty..."); - return []; + await cache.SetAsync(FeaturedPostCacheKey, featuredIds, TimeSpan.FromMinutes(5)); } var posts = await db.Posts