Skip to content

Commit 7b786ba

Browse files
authored
Merge pull request #123 from cleverhu/fix-remain-count
Supports remaincount as a negative number
2 parents 29b5776 + d3daa40 commit 7b786ba

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

pkg/storage/internalstorage/resource_storage.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,10 +204,9 @@ func (s *ResourceStorage) List(ctx context.Context, listObject runtime.Object, o
204204
}
205205

206206
if amount != nil {
207+
// When offset is too large, the data in the response is empty and the remaining count is negative.
208+
// This ensures that `amount = offset + len(objects) + remain`
207209
remain := *amount - offset - int64(len(objects))
208-
if remain < 0 {
209-
remain = 0
210-
}
211210
list.SetRemainingItemCount(&remain)
212211
}
213212

0 commit comments

Comments
 (0)