From 623fdb4f335d02b37e10df63146edff53582238f Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Sun, 26 May 2024 12:25:32 +1000 Subject: [PATCH] Use taskID mutex properly --- pkg/tasks/tasks.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/tasks/tasks.go b/pkg/tasks/tasks.go index e6b9d4ac..06fac38f 100644 --- a/pkg/tasks/tasks.go +++ b/pkg/tasks/tasks.go @@ -65,9 +65,12 @@ func (t *TaskManager) NewTask(f func(ctx context.Context)) error { t.waitingMutex.Lock() defer t.waitingMutex.Unlock() + t.taskIDMutex.Lock() if taskID < t.newTaskId { + t.taskIDMutex.Unlock() return } + t.taskIDMutex.Unlock() ctx, cancel := context.WithCancel(context.Background()) notifyStopped := make(chan struct{})