check queue's status before enqueue

This commit is contained in:
chentao1596 2017-01-04 20:14:08 +08:00
parent 5186e93c48
commit e454732508

View file

@ -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 {