From 71e42bf65cdebf06d7c2a29ea79299e33cd88af3 Mon Sep 17 00:00:00 2001 From: Lantao Liu Date: Sun, 3 Dec 2017 21:19:52 +0000 Subject: [PATCH] Lock task list properly. Signed-off-by: Lantao Liu --- runtime/task_list.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/runtime/task_list.go b/runtime/task_list.go index 7c522655f..05f34c323 100644 --- a/runtime/task_list.go +++ b/runtime/task_list.go @@ -49,6 +49,8 @@ func (l *TaskList) Get(ctx context.Context, id string) (Task, error) { // GetAll tasks under a namespace func (l *TaskList) GetAll(ctx context.Context) ([]Task, error) { + l.mu.Lock() + defer l.mu.Unlock() namespace, err := namespaces.NamespaceRequired(ctx) if err != nil { return nil, err