From 5dcc954072ca0a27107ed3fdc6806986f61df7d0 Mon Sep 17 00:00:00 2001 From: kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com> Date: Thu, 6 Jun 2024 10:44:43 +0000 Subject: [feature] do not uncache status / emoji media if attached status is bookmarked (#2956) * do not uncache status / emoji media if attached status is bookmarked * add status bookmark and bookmark IDs caches * update status bookmark tests * move IsStatusBookmarkedBy() to StatusBookmark{} interface, rely on cache * fix envparsing.sh test --- internal/cache/size.go | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'internal/cache/size.go') diff --git a/internal/cache/size.go b/internal/cache/size.go index 758d191be..e205bf023 100644 --- a/internal/cache/size.go +++ b/internal/cache/size.go @@ -201,6 +201,8 @@ func totalOfRatios() float64 { config.GetCachePollVoteMemRatio() + config.GetCacheReportMemRatio() + config.GetCacheStatusMemRatio() + + config.GetCacheStatusBookmarkMemRatio() + + config.GetCacheStatusBookmarkIDsMemRatio() + config.GetCacheStatusFaveMemRatio() + config.GetCacheStatusFaveIDsMemRatio() + config.GetCacheTagMemRatio() + @@ -566,7 +568,7 @@ func sizeofReport() uintptr { func sizeofStatus() uintptr { return uintptr(size.Of(>smodel.Status{ - ID: exampleURI, + ID: exampleID, URI: exampleURI, URL: exampleURI, Content: exampleText, @@ -599,6 +601,20 @@ func sizeofStatus() uintptr { })) } +func sizeofStatusBookmark() uintptr { + return uintptr(size.Of(>smodel.StatusBookmark{ + ID: exampleID, + AccountID: exampleID, + Account: nil, + TargetAccountID: exampleID, + TargetAccount: nil, + StatusID: exampleID, + Status: nil, + CreatedAt: exampleTime, + UpdatedAt: exampleTime, + })) +} + func sizeofStatusFave() uintptr { return uintptr(size.Of(>smodel.StatusFave{ ID: exampleID, -- cgit v1.2.3