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