diff options
Diffstat (limited to 'internal/db/bundb/relationship_block.go')
-rw-r--r-- | internal/db/bundb/relationship_block.go | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/internal/db/bundb/relationship_block.go b/internal/db/bundb/relationship_block.go index 178de6aa7..d994559ab 100644 --- a/internal/db/bundb/relationship_block.go +++ b/internal/db/bundb/relationship_block.go @@ -101,23 +101,10 @@ func (r *relationshipDB) GetBlock(ctx context.Context, sourceAccountID string, t } func (r *relationshipDB) GetBlocksByIDs(ctx context.Context, ids []string) ([]*gtsmodel.Block, error) { - // Preallocate at-worst possible length. - uncached := make([]string, 0, len(ids)) - // Load all blocks IDs via cache loader callbacks. - blocks, err := r.state.Caches.GTS.Block.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 block loader function. - func() ([]*gtsmodel.Block, error) { + blocks, err := r.state.Caches.GTS.Block.LoadIDs("ID", + ids, + func(uncached []string) ([]*gtsmodel.Block, error) { // Preallocate expected length of uncached blocks. blocks := make([]*gtsmodel.Block, 0, len(uncached)) |