From e454732508449fbc1abf3951678c793e4a160061 Mon Sep 17 00:00:00 2001 From: chentao1596 Date: Wed, 4 Jan 2017 20:14:08 +0800 Subject: [PATCH] check queue's status before enqueue --- core/pkg/task/queue.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/pkg/task/queue.go b/core/pkg/task/queue.go index e7fd0a848..d29f3c2c9 100644 --- a/core/pkg/task/queue.go +++ b/core/pkg/task/queue.go @@ -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 {