diff options
Diffstat (limited to 'internal/db/bundb/poll.go')
-rw-r--r-- | internal/db/bundb/poll.go | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/internal/db/bundb/poll.go b/internal/db/bundb/poll.go index 37a1f26ab..33b621805 100644 --- a/internal/db/bundb/poll.go +++ b/internal/db/bundb/poll.go @@ -270,23 +270,10 @@ func (p *pollDB) GetPollVotes(ctx context.Context, pollID string) ([]*gtsmodel.P return nil, err } - // Preallocate at-worst possible length. - uncached := make([]string, 0, len(voteIDs)) - // Load all votes from IDs via cache loader callbacks. - votes, err := p.state.Caches.GTS.PollVote.Load("ID", - - // Load cached + check for uncached. - func(load func(keyParts ...any) bool) { - for _, id := range voteIDs { - if !load(id) { - uncached = append(uncached, id) - } - } - }, - - // Uncached poll vote loader function. - func() ([]*gtsmodel.PollVote, error) { + votes, err := p.state.Caches.GTS.PollVote.LoadIDs("ID", + voteIDs, + func(uncached []string) ([]*gtsmodel.PollVote, error) { // Preallocate expected length of uncached votes. votes := make([]*gtsmodel.PollVote, 0, len(uncached)) |