mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 10:51:29 +00:00
Merge pull request #112476 from enj/enj/i/list_pager_flake
Check for context cancellation on each buffered chunk
This commit is contained in:
commit
be506dc46e
@ -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