mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-07 03:03:59 +00:00
Check for context cancellation on each buffered chunk
TestListPager_EachListItem flakes without this change. Signed-off-by: Monis Khan <mok@microsoft.com>
This commit is contained in:
parent
7a68c8a21a
commit
7458ed01d6
@ -203,6 +203,11 @@ func (p *ListPager) eachListChunkBuffered(ctx context.Context, options metav1.Li
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
for o := range chunkC {
|
for o := range chunkC {
|
||||||
|
select {
|
||||||
|
case <-ctx.Done():
|
||||||
|
return ctx.Err()
|
||||||
|
default:
|
||||||
|
}
|
||||||
err := fn(o)
|
err := fn(o)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err // any fn error should be returned immediately
|
return err // any fn error should be returned immediately
|
||||||
|
Loading…
Reference in New Issue
Block a user