diff options
author | 2024-04-02 11:03:40 +0100 | |
---|---|---|
committer | 2024-04-02 12:03:40 +0200 | |
commit | adf345f1ec0cb76a0df94a4505143d891659cba9 (patch) | |
tree | e0cca289c0a50f30191d4b65a2c336704570e470 /internal/db/bundb/relationship_follow_req.go | |
parent | [feature] Option to hide followers/following (#2788) (diff) | |
download | gotosocial-adf345f1ec0cb76a0df94a4505143d891659cba9.tar.xz |
[chore] bump go structr cache version -> v0.6.0 (#2773)
* update go-structr library -> v0.6.0, add necessary wrapping types + code changes to support these changes
* update readme with go-structr package changes
* improved wrapping of the SliceCache type
* add code comments for the cache wrapper types
* remove test.out :innocent:
---------
Co-authored-by: tobi <31960611+tsmethurst@users.noreply.github.com>
Diffstat (limited to 'internal/db/bundb/relationship_follow_req.go')
-rw-r--r-- | internal/db/bundb/relationship_follow_req.go | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/internal/db/bundb/relationship_follow_req.go b/internal/db/bundb/relationship_follow_req.go index 6fd5eefba..0b897f1fa 100644 --- a/internal/db/bundb/relationship_follow_req.go +++ b/internal/db/bundb/relationship_follow_req.go @@ -77,23 +77,10 @@ func (r *relationshipDB) GetFollowRequest(ctx context.Context, sourceAccountID s } func (r *relationshipDB) GetFollowRequestsByIDs(ctx context.Context, ids []string) ([]*gtsmodel.FollowRequest, error) { - // Preallocate at-worst possible length. - uncached := make([]string, 0, len(ids)) - // Load all follow IDs via cache loader callbacks. - follows, err := r.state.Caches.GTS.FollowRequest.Load("ID", - - // Load cached + check for uncached. - func(load func(keyParts ...any) bool) { - for _, id := range ids { - if !load(id) { - uncached = append(uncached, id) - } - } - }, - - // Uncached follow req loader function. - func() ([]*gtsmodel.FollowRequest, error) { + follows, err := r.state.Caches.GTS.FollowRequest.LoadIDs("ID", + ids, + func(uncached []string) ([]*gtsmodel.FollowRequest, error) { // Preallocate expected length of uncached followReqs. follows := make([]*gtsmodel.FollowRequest, 0, len(uncached)) |