From 56075b57c421fc5e751c1da7a7f1bf18ec1499a7 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 26 Jun 2024 18:45:40 +0200 Subject: [PATCH] fix(runner): bring concurrency back --- lua/lazy/manage/runner.lua | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/lua/lazy/manage/runner.lua b/lua/lazy/manage/runner.lua index 0b0e5c4..eac6b3e 100644 --- a/lua/lazy/manage/runner.lua +++ b/lua/lazy/manage/runner.lua @@ -96,19 +96,21 @@ function Runner:_start() waiting = waiting + 1 wait_step = s.step elseif not running then - local plugin = self:plugin(name) - if s.step == #self._pipeline then - s.task = nil - plugin._.working = false - elseif s.step < #self._pipeline then - active = active + 1 - s.step = s.step + 1 - step = self._pipeline[s.step] - if step.task == "wait" then + if not self._opts.concurrency or active < self._opts.concurrency then + local plugin = self:plugin(name) + if s.step == #self._pipeline then + s.task = nil plugin._.working = false - else - s.task = self:queue(plugin, step) - plugin._.working = not not s.task + elseif s.step < #self._pipeline then + active = active + 1 + s.step = s.step + 1 + step = self._pipeline[s.step] + if step.task == "wait" then + plugin._.working = false + else + s.task = self:queue(plugin, step) + plugin._.working = not not s.task + end end end else