From 406b2b3af7ce5cbdaa719b2e8dda0caeeed89cb9 Mon Sep 17 00:00:00 2001 From: Matthias Bertschy Date: Tue, 19 Nov 2024 14:58:01 +0100 Subject: [PATCH] set default limit for GetList Signed-off-by: Matthias Bertschy --- pkg/registry/file/storage.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/registry/file/storage.go b/pkg/registry/file/storage.go index a0841d382..c3bd34b3c 100644 --- a/pkg/registry/file/storage.go +++ b/pkg/registry/file/storage.go @@ -353,6 +353,10 @@ func (s *StorageImpl) GetList(ctx context.Context, key string, opts storage.List logger.L().Ctx(ctx).Error("GetList - need ptr to slice", helpers.Error(err), helpers.String("key", key)) return fmt.Errorf("need ptr to slice: %v", err) } + // set default limit + if opts.Predicate.Limit == 0 { + opts.Predicate.Limit = 500 + } // get metadata from SQLite conn, err := s.pool.Take(context.Background()) if err != nil {