mirror of
https://github.com/kubernetes/client-go.git
synced 2025-08-11 12:11:52 +00:00
handle context in process loop
Kubernetes-commit: f67d30b3529ea970dd5fd069eaddfc7f61d74169
This commit is contained in:
parent
660181394a
commit
03728c1ebe
16
tools/cache/controller.go
vendored
16
tools/cache/controller.go
vendored
@ -204,13 +204,15 @@ func (c *controller) LastSyncResourceVersion() string {
|
|||||||
// concurrently.
|
// concurrently.
|
||||||
func (c *controller) processLoop(ctx context.Context) {
|
func (c *controller) processLoop(ctx context.Context) {
|
||||||
for {
|
for {
|
||||||
// TODO: Plumb through the ctx so that this can
|
select {
|
||||||
// actually exit when the controller is stopped. Or just give up on this stuff
|
case <-ctx.Done():
|
||||||
// ever being stoppable.
|
return
|
||||||
_, err := c.config.Queue.Pop(PopProcessFunc(c.config.Process))
|
default:
|
||||||
if err != nil {
|
_, err := c.config.Queue.Pop(PopProcessFunc(c.config.Process))
|
||||||
if err == ErrFIFOClosed {
|
if err != nil {
|
||||||
return
|
if err == ErrFIFOClosed {
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user