X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/a95f899d7ac84f29b3d019aa410d265bb40833e5..9d1f08198723f64d23473bb0ef1d6e30df1f4a1f:/services/keep-balance/collection.go diff --git a/services/keep-balance/collection.go b/services/keep-balance/collection.go index e6a1f08cf1..f4fc72152f 100644 --- a/services/keep-balance/collection.go +++ b/services/keep-balance/collection.go @@ -22,7 +22,10 @@ func countCollections(c *arvados.Client, params arvados.ResourceListParams) (int // The progress function is called periodically with done (number of // times f has been called) and total (number of times f is expected // to be called). -func EachCollection(c *arvados.Client, f func(arvados.Collection) error, progress func(done, total int)) error { +// +// If pageSize > 0 it is used as the maximum page size in each API +// call; otherwise the maximum allowed page size is requested. +func EachCollection(c *arvados.Client, pageSize int, f func(arvados.Collection) error, progress func(done, total int)) error { if progress == nil { progress = func(_, _ int) {} } @@ -32,7 +35,11 @@ func EachCollection(c *arvados.Client, f func(arvados.Collection) error, progres return err } - limit := 1000 + limit := pageSize + if limit <= 0 { + // Use the maximum page size the server allows + limit = 1<<31 - 1 + } params := arvados.ResourceListParams{ Limit: &limit, Order: "modified_at, uuid",