summaryrefslogtreecommitdiff
path: root/internal/db/bundb/statusfave.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/db/bundb/statusfave.go')
-rw-r--r--internal/db/bundb/statusfave.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/internal/db/bundb/statusfave.go b/internal/db/bundb/statusfave.go
index cf20fbba3..eb372c24b 100644
--- a/internal/db/bundb/statusfave.go
+++ b/internal/db/bundb/statusfave.go
@@ -133,8 +133,15 @@ func (s *statusFaveDB) GetStatusFaves(ctx context.Context, statusID string) ([]*
faves, err := s.state.Caches.DB.StatusFave.LoadIDs("ID",
faveIDs,
func(uncached []string) ([]*gtsmodel.StatusFave, error) {
+ // Avoid querying
+ // if none uncached.
+ count := len(uncached)
+ if count == 0 {
+ return nil, nil
+ }
+
// Preallocate expected length of uncached faves.
- faves := make([]*gtsmodel.StatusFave, 0, len(uncached))
+ faves := make([]*gtsmodel.StatusFave, 0, count)
// Perform database query scanning
// the remaining (uncached) fave IDs.