check queue's status before enqueue
@@ -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 {
