From 71080590bb46c0148e5c741c3d196632b834b475 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst-Satzkorn Date: Tue, 31 Oct 2023 10:20:26 -0700 Subject: [PATCH] fixup! handlers/targets: add pagination support --- globals/globals.go | 3 +++ .../daemon/controller/handlers/targets/target_service.go | 5 +---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/globals/globals.go b/globals/globals.go index e0abb6b27d..32c596820b 100644 --- a/globals/globals.go +++ b/globals/globals.go @@ -26,6 +26,9 @@ var ( // DefaultMaxRequestSize is the maximum size of a request we allow by default DefaultMaxRequestSize = int64(1024 * 1024) + // DefaultMaxPageSize is the maximum list page size allowed if not set in the config. + DefaultMaxPageSize = 1000 + // ContextMaxRequestSizeTypeKey is a value to keep linters from complaining // about clashing string identifiers ContextMaxRequestSizeTypeKey ContextMaxRequestSizeType diff --git a/internal/daemon/controller/handlers/targets/target_service.go b/internal/daemon/controller/handlers/targets/target_service.go index b7f67d5d70..f2a4357a3e 100644 --- a/internal/daemon/controller/handlers/targets/target_service.go +++ b/internal/daemon/controller/handlers/targets/target_service.go @@ -55,9 +55,6 @@ import ( const ( credentialDomain = "credential" hostDomain = "host" - // The default max page size is used when one is not - // provided to NewService. - defaultMaxPageSize = 1000 ) // extraWorkerFilterFunc takes in a set of workers and returns another set, @@ -178,7 +175,7 @@ func NewService( return Service{}, errors.New(ctx, errors.InvalidParameter, op, "missing static credential repository") } if maxPageSize == 0 { - maxPageSize = uint(defaultMaxPageSize) + maxPageSize = uint(globals.DefaultMaxPageSize) } return Service{ repoFn: repoFn,