mirror of
https://github.com/kubernetes/client-go.git
synced 2025-06-27 15:39:39 +00:00
Merge pull request #89348 from fatedier/workqueue
Export new constructor for DelayingQueue Kubernetes-commit: 348152583c699fd8e7b3f67038418423d009f5e4
This commit is contained in:
commit
6cdba17191
@ -38,6 +38,12 @@ func NewDelayingQueue() DelayingInterface {
|
|||||||
return NewDelayingQueueWithCustomClock(clock.RealClock{}, "")
|
return NewDelayingQueueWithCustomClock(clock.RealClock{}, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewDelayingQueueWithCustomQueue constructs a new workqueue with ability to
|
||||||
|
// inject custom queue Interface instead of the default one
|
||||||
|
func NewDelayingQueueWithCustomQueue(q Interface, name string) DelayingInterface {
|
||||||
|
return newDelayingQueue(clock.RealClock{}, q, name)
|
||||||
|
}
|
||||||
|
|
||||||
// NewNamedDelayingQueue constructs a new named workqueue with delayed queuing ability
|
// NewNamedDelayingQueue constructs a new named workqueue with delayed queuing ability
|
||||||
func NewNamedDelayingQueue(name string) DelayingInterface {
|
func NewNamedDelayingQueue(name string) DelayingInterface {
|
||||||
return NewDelayingQueueWithCustomClock(clock.RealClock{}, name)
|
return NewDelayingQueueWithCustomClock(clock.RealClock{}, name)
|
||||||
@ -46,8 +52,12 @@ func NewNamedDelayingQueue(name string) DelayingInterface {
|
|||||||
// NewDelayingQueueWithCustomClock constructs a new named workqueue
|
// NewDelayingQueueWithCustomClock constructs a new named workqueue
|
||||||
// with ability to inject real or fake clock for testing purposes
|
// with ability to inject real or fake clock for testing purposes
|
||||||
func NewDelayingQueueWithCustomClock(clock clock.Clock, name string) DelayingInterface {
|
func NewDelayingQueueWithCustomClock(clock clock.Clock, name string) DelayingInterface {
|
||||||
|
return newDelayingQueue(clock, NewNamed(name), name)
|
||||||
|
}
|
||||||
|
|
||||||
|
func newDelayingQueue(clock clock.Clock, q Interface, name string) *delayingType {
|
||||||
ret := &delayingType{
|
ret := &delayingType{
|
||||||
Interface: NewNamed(name),
|
Interface: q,
|
||||||
clock: clock,
|
clock: clock,
|
||||||
heartbeat: clock.NewTicker(maxWait),
|
heartbeat: clock.NewTicker(maxWait),
|
||||||
stopCh: make(chan struct{}),
|
stopCh: make(chan struct{}),
|
||||||
@ -56,7 +66,6 @@ func NewDelayingQueueWithCustomClock(clock clock.Clock, name string) DelayingInt
|
|||||||
}
|
}
|
||||||
|
|
||||||
go ret.waitingLoop()
|
go ret.waitingLoop()
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user