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