From c6ba099428833a611059f7b15bf27201b5d588ce Mon Sep 17 00:00:00 2001 From: Hatsuyuki Date: Thu, 15 Sep 2022 13:17:52 +0000 Subject: [PATCH] fix incorrect scaling behaviour with buffer capacity in some edge cases --- engine/planner.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/planner.go b/engine/planner.go index f71b10e6..06db743d 100644 --- a/engine/planner.go +++ b/engine/planner.go @@ -76,8 +76,8 @@ func (p *planner) Plan(ctx context.Context) error { ctx = logger.WithContext(ctx, log) - free := max(capacity-running-p.buffer, 0) - diff := serverDiff(pending, free, p.cap) + free := max(capacity-running, 0) + diff := serverDiff(pending+p.buffer, free, p.cap) // if the server differential to handle the build volume // is positive, we can reduce server capacity.