From f4319740ab02d680961781861335285f618f5f48 Mon Sep 17 00:00:00 2001 From: kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com> Date: Tue, 18 Jul 2023 09:43:17 +0100 Subject: [bugfix] more robust list timeline invalidation (#1995) --- internal/cache/cache.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'internal/cache/cache.go') diff --git a/internal/cache/cache.go b/internal/cache/cache.go index df7d9a7ae..63564935e 100644 --- a/internal/cache/cache.go +++ b/internal/cache/cache.go @@ -93,13 +93,14 @@ func (c *Caches) setuphooks() { }) c.GTS.EmojiCategory().SetInvalidateCallback(func(category *gtsmodel.EmojiCategory) { - // Invalidate entire emoji cache, - // as we can't know which emojis - // specifically this will effect. - c.GTS.Emoji().Clear() + // Invalidate any emoji in this category. + c.GTS.Emoji().Invalidate("CategoryID", category.ID) }) c.GTS.Follow().SetInvalidateCallback(func(follow *gtsmodel.Follow) { + // Invalidate any related list entries. + c.GTS.ListEntry().Invalidate("FollowID", follow.ID) + // Invalidate follow origin account ID cached visibility. c.Visibility.Invalidate("ItemID", follow.AccountID) c.Visibility.Invalidate("RequesterID", follow.AccountID) @@ -122,6 +123,11 @@ func (c *Caches) setuphooks() { c.GTS.Follow().Invalidate("ID", followReq.ID) }) + c.GTS.List().SetInvalidateCallback(func(list *gtsmodel.List) { + // Invalidate all cached entries of this list. + c.GTS.ListEntry().Invalidate("ListID", list.ID) + }) + c.GTS.Status().SetInvalidateCallback(func(status *gtsmodel.Status) { // Invalidate status ID cached visibility. c.Visibility.Invalidate("ItemID", status.ID) -- cgit v1.2.3