From 2bdff66f0a12a16684e5d25bcace551446ec1c78 Mon Sep 17 00:00:00 2001 From: kim Date: Wed, 15 Oct 2025 13:32:02 +0200 Subject: [performance] cache account IDs in home timeline query not in exclusive lists (#4502) this caches the stage of the home timeline query in which we calculate which account IDs should be shown in a particular user's timeline. Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4502 Co-authored-by: kim Co-committed-by: kim --- internal/cache/invalidate.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'internal/cache/invalidate.go') diff --git a/internal/cache/invalidate.go b/internal/cache/invalidate.go index c6c25d4eb..58c427050 100644 --- a/internal/cache/invalidate.go +++ b/internal/cache/invalidate.go @@ -155,6 +155,9 @@ func (c *Caches) OnInvalidateFollow(follow *gtsmodel.Follow) { // results for them as mute / visibility result requester. if follow.Account == nil || follow.Account.IsLocal() { localAccountIDs = append(localAccountIDs, follow.AccountID) + + // Also invalidate their home account IDs cache. + c.DB.HomeAccountIDs.Invalidate(follow.AccountID) } // If target is local (or uncertain), also invalidate @@ -261,6 +264,10 @@ func (c *Caches) OnInvalidateList(list *gtsmodel.List) { // follow IDs in list. "f"+list.ID, ) + + // Invalidate user's home account IDs cache, + // as list exclusivity flag may have changed. + c.DB.HomeAccountIDs.Invalidate(list.AccountID) } func (c *Caches) OnInvalidateMedia(media *gtsmodel.MediaAttachment) { -- cgit v1.2.3