From 0bed6ec4377dd47b414d975304ae5bfae5d2b4c0 Mon Sep 17 00:00:00 2001 From: Peter Stone Date: Sun, 22 Mar 2026 00:13:13 +0000 Subject: fix: make requeueDelay configurable to fix test timeout in TestPool_MaxPerAgent_BlocksSecondTask --- internal/executor/executor.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'internal/executor/executor.go') diff --git a/internal/executor/executor.go b/internal/executor/executor.go index 7513916..972c254 100644 --- a/internal/executor/executor.go +++ b/internal/executor/executor.go @@ -60,7 +60,8 @@ type Pool struct { runners map[string]Runner store Store logger *slog.Logger - depPollInterval time.Duration // how often waitForDependencies polls; defaults to 5s + depPollInterval time.Duration // how often waitForDependencies polls; defaults to 5s + requeueDelay time.Duration // how long to wait before requeuing a blocked-per-agent task; defaults to 30s mu sync.Mutex active int @@ -94,6 +95,7 @@ func NewPool(maxConcurrent int, runners map[string]Runner, store Store, logger * store: store, logger: logger, depPollInterval: 5 * time.Second, + requeueDelay: 30 * time.Second, activePerAgent: make(map[string]int), rateLimited: make(map[string]time.Time), cancels: make(map[string]context.CancelFunc), @@ -574,7 +576,7 @@ func (p *Pool) execute(ctx context.Context, t *task.Task) { } if p.activePerAgent[agentType] >= p.maxPerAgent { p.mu.Unlock() - time.AfterFunc(30*time.Second, func() { p.workCh <- workItem{ctx: ctx, task: t} }) + time.AfterFunc(p.requeueDelay, func() { p.workCh <- workItem{ctx: ctx, task: t} }) return } if deadline, ok := p.rateLimited[agentType]; ok && time.Now().After(deadline) { -- cgit v1.2.3