summaryrefslogtreecommitdiff
path: root/internal/db/bundb/relationship_block.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/db/bundb/relationship_block.go')
-rw-r--r--internal/db/bundb/relationship_block.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/internal/db/bundb/relationship_block.go b/internal/db/bundb/relationship_block.go
index 4e5d4c254..99d77c745 100644
--- a/internal/db/bundb/relationship_block.go
+++ b/internal/db/bundb/relationship_block.go
@@ -105,8 +105,15 @@ func (r *relationshipDB) GetBlocksByIDs(ctx context.Context, ids []string) ([]*g
blocks, err := r.state.Caches.DB.Block.LoadIDs("ID",
ids,
func(uncached []string) ([]*gtsmodel.Block, error) {
+ // Avoid querying
+ // if none uncached.
+ count := len(uncached)
+ if count == 0 {
+ return nil, nil
+ }
+
// Preallocate expected length of uncached blocks.
- blocks := make([]*gtsmodel.Block, 0, len(uncached))
+ blocks := make([]*gtsmodel.Block, 0, count)
// Perform database query scanning
// the remaining (uncached) IDs.