remove zero checks in uncached key load functions (go-structr now handles this)

This commit is contained in:
kim 2024-09-12 18:31:10 +01:00
commit bca5e1b926
20 changed files with 21 additions and 167 deletions

View file

@ -54,15 +54,8 @@ func (s *statusDB) GetStatusesByIDs(ctx context.Context, ids []string) ([]*gtsmo
statuses, err := s.state.Caches.DB.Status.LoadIDs("ID",
ids,
func(uncached []string) ([]*gtsmodel.Status, error) {
// Avoid querying
// if none uncached.
count := len(uncached)
if count == 0 {
return nil, nil
}
// Preallocate expected length of uncached statuses.
statuses := make([]*gtsmodel.Status, 0, count)
statuses := make([]*gtsmodel.Status, 0, len(uncached))
// Perform database query scanning
// the remaining (uncached) status IDs.