check queue's status before enqueue
This commit is contained in:
parent
5186e93c48
commit
e454732508
1 changed files with 5 additions and 0 deletions
|
@ -51,6 +51,11 @@ func (t *Queue) Run(period time.Duration, stopCh <-chan struct{}) {
|
|||
|
||||
// Enqueue enqueues ns/name of the given api object in the task queue.
|
||||
func (t *Queue) Enqueue(obj interface{}) {
|
||||
if t.IsShuttingDown() {
|
||||
glog.Errorf("queue has been shutdown, failed to enqueue: %v", obj)
|
||||
return
|
||||
}
|
||||
|
||||
glog.V(3).Infof("queuing item %v", obj)
|
||||
key, err := t.fn(obj)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in a new issue