Add a way to score every unscored lead without polling
Test and deploy / test (push) Successful in 2m1s
Test and deploy / deploy (push) Successful in 1m21s

A run caps its scoring at forty leads, so a first poll of several boards
left a backlog that could only be cleared by pressing "Check now"
repeatedly, re-fetching every source each time.

scoreJobLeads (JobLeadService.ScoreAll, "Score unscored" on /cv/leads)
re-applies the keyword filter and then scores every matched, unscored
lead, with no cap on the count and a one-hour limit on the time. A lead
Claude fails on is tried once per press rather than three times, so a
passing failure does not write it off. It shares the run lock and the
polled status with runJobLeadSync, and the page now reloads the leads
while either job is in flight.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-12 15:36:32 +01:00
co-authored by Claude Opus 5.5
parent af50e6c8ab
commit 299b5f5224
8 changed files with 216 additions and 41 deletions
+8 -1
View File
@@ -284,11 +284,18 @@ throughout (`graph/schema/job_lead.graphql`, all `@admin`) with the work in
lead Claude cannot score is retried on three runs and then left. With an
empty profile nothing is scored. If scoring is unavailable (no API key,
Python down) the run stops scoring without spending an attempt on any lead.
- **Scoring the backlog.** The `scoreJobLeads` mutation
(`JobLeadService.ScoreAll`, "Score unscored" on the page) scores every
matched, unscored lead with no cap and without polling any source. It is
for the backlog a first poll of several boards leaves behind, or leads
that arrived before the profile was written. A lead that fails is tried
once per press. It stops after an hour; pressing again continues.
- **When it runs.** `JOB_LEADS_ENABLED=true` starts a timer
(`JOB_LEADS_INTERVAL`, default `6h`); it does not run at start-up, so a
deploy spends nothing. The `runJobLeadSync` mutation starts a run in a
goroutine and returns at once, whether or not the timer is on, and
`jobLeadSyncStatus` reports on it — a run can take minutes, so unlike
`jobLeadSyncStatus` reports on it (and on `scoreJobLeads`; only one of
the two jobs runs at a time) — a run can take minutes, so unlike
`POST /email/sync` it does not hold the request open. The status is in
memory and resets on restart.
- **Promotion** (`promoteJobLead`) is the only way a lead reaches the tracker.