From ea2f1b50b7199d9dfe7793950fe2bb34a3da5790 Mon Sep 17 00:00:00 2001 From: jedarden Date: Fri, 24 Apr 2026 17:24:57 -0400 Subject: [PATCH] fix(matchmaker): stale-reaper queries claimed not running status MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Jobs remain in 'claimed' status until completed — the reaper was querying 'running' (which is the match status, not job status) so stale claimed jobs were never recycled. Co-Authored-By: Claude Sonnet 4.6 --- cmd/acb-matchmaker/tickers.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/acb-matchmaker/tickers.go b/cmd/acb-matchmaker/tickers.go index 34b27fd..927b220 100644 --- a/cmd/acb-matchmaker/tickers.go +++ b/cmd/acb-matchmaker/tickers.go @@ -560,7 +560,7 @@ func (m *Matchmaker) tickStaleReaper(ctx context.Context) { rows, err := m.db.QueryContext(ctx, `SELECT job_id FROM jobs - WHERE status = 'running' AND claimed_at < $1`, + WHERE status = 'claimed' AND claimed_at < $1`, time.Now().Add(-threshold)) if err != nil { log.Printf("stale-reaper: query error: %v", err) @@ -581,7 +581,7 @@ func (m *Matchmaker) tickStaleReaper(ctx context.Context) { for _, jobID := range staleJobs { result, err := m.db.ExecContext(ctx, `UPDATE jobs SET status = 'pending', worker_id = NULL, claimed_at = NULL - WHERE job_id = $1 AND status = 'running'`, jobID) + WHERE job_id = $1 AND status = 'claimed'`, jobID) if err != nil { log.Printf("stale-reaper: update error for %s: %v", jobID, err) continue