From 821e371cd80a56bb45bcce6591a0955c1126dc4f Mon Sep 17 00:00:00 2001 From: Simone Gotti Date: Wed, 15 May 2019 15:06:46 +0200 Subject: [PATCH] executor: don't start task if max tasks limit has been reached --- internal/services/executor/executor.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal/services/executor/executor.go b/internal/services/executor/executor.go index e7ac219..c34b29c 100644 --- a/internal/services/executor/executor.go +++ b/internal/services/executor/executor.go @@ -753,6 +753,13 @@ func (e *Executor) executeTask(ctx context.Context, et *types.ExecutorTask) { return } + activeTasks := e.runningTasks.len() + // don't start task if we have reached the active tasks limit + // they will be executed later + if activeTasks > e.c.ActiveTasksLimit { + return + } + rt := &runningTask{ et: et, }