From 289a19d4dadac4a0605cf1c82acf930f7389eef0 Mon Sep 17 00:00:00 2001 From: hole-thu Date: Wed, 17 May 2023 03:28:20 +0800 Subject: [PATCH] fix: not put new post into reply timeline cache --- src/models.rs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/models.rs b/src/models.rs index cd4ce7a..6e1beb8 100644 --- a/src/models.rs +++ b/src/models.rs @@ -356,14 +356,16 @@ impl Post { pub async fn refresh_cache(&self, rconn: &RdsConn, is_new: bool) { join!( self.set_instance_cache(rconn), - future::join_all((if is_new { 0..5 } else { 1..5 }).map(|mode| async move { - PostListCache::init(None, mode, &rconn.clone()) - .put(self) - .await; - PostListCache::init(Some(self.room_id), mode, &rconn.clone()) - .put(self) - .await; - })), + future::join_all((if is_new { [0, 2, 3, 4] } else { [1, 2, 3, 4] }).map( + |mode| async move { + PostListCache::init(None, mode, &rconn.clone()) + .put(self) + .await; + PostListCache::init(Some(self.room_id), mode, &rconn.clone()) + .put(self) + .await; + } + )), ); }