fix(matchmaker): stale-reaper queries claimed not running status
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 <noreply@anthropic.com>
This commit is contained in:
parent
f4baa4b817
commit
ea2f1b50b7
1 changed files with 2 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue