Nobody has started this yet — be first.
Business impact
A job whose execution regularly takes longer than its own cron interval (a slow every-minute job that sometimes takes 90 seconds) will, today, happily pile up overlapping executions of itself: the materializer creates a new due occurrence on schedule regardless of whether the previous one has finished. For a job that isn't safely re-entrant on the target side, this means concurrent duplicate work against the same downstream system exactly when it's already under load -- the worst possible time to pile on more concurrent requests to it.
Problem
pkg/queue.Queue has no way to answer "does this job currently have a run in progress?" HasActiveRun is a placeholder that panics with "TODO(ticket-E5): HasActiveRun not implemented".
Current behavior
Calling HasActiveRun for any job, including one with no runs at all, panics instead of returning a boolean.
Expected behavior
Queue.HasActiveRun(ctx, jobID) returns whether the given job currently has any job_runs row in 'leased' or 'running' status. This is the building block a cron materializer could eventually use to skip creating a new occurrence while the previous one is still in flight.
Steps to reproduce
Why this matters
This is a simple existence check (EXISTS (SELECT 1 FROM job_runs WHERE job_id = $1 AND status IN ('leased', 'running'))), but it's the prerequisite for a meaningful "skip if still running" policy -- without it, there's no way to even ask the question.
Suggested approach
Look at how other pkg/queue methods query job_runs by job_id and by status (e.g. ListByJob, ReclaimExpiredLeases's WHERE status IN (...)) for the patterns to combine here.
Acceptance criteria
Verification
TEST_DATABASE_URL="postgresql://chronos:chronos@localhost:5432/chronos?sslmode=disable" go test ./tickets/tests/... -run TestTicket14 -v
Hints (0/2)
Try it without hints first — the reading is the exercise.
Working on this ticket
Work on a branch named for the ticket — that's what you'll submit.
Branch off your fork
Sign in to create it automatically, or do it yourself:
$git checkout -b feat/has-active-runFix it and commit
Meet every acceptance criterion, and add a test that would have caught this.
Push the branch
$git push -u origin feat/has-active-runSubmit it below
Paste your fork URL and the branch name, with a short write-up of the root cause.
Questions
Ask about anything unclear in the ticket — the maintainer and anyone who has solved it can answer. Please don't post full solutions.
Sign in to ask a question or reply.
Sign inhttp://localhost:8081app-1http://localhost:8082app-2http://localhost:8090curl localhost:8081/healthzcurl localhost:8081/readyzWork the tickets in tickets/docs/ (ordered easy → hard); each names one Go test in tickets/tests/. Most tickets need a real Postgres (tickets 4, 11, and 18 are pure-function tests and do not):
export TEST_DATABASE_URL="postgresql://chronos:chronos@localhost:5432/chronos?sslmode=disable"
go test ./tickets/tests/... -run TestTicket08 -v # a single ticket
./tickets/run_tickets.sh # all 20, clean pass/fail summary
Use -race when working on tickets 15, 16, or 17 (the concurrency ones) -- run_tickets.sh already does this for every ticket. Tickets 15 and 16 are adjacent bugs in the same function (pkg/leader/leader.go's lock-release path); fix ticket 16 first, since ticket 15's test keeps failing for ticket 16's reason until that one is fixed too.
Level 2
Implement a feature
Extend the system within its own patterns.