chore(earnings): enable the earnings indexer cron (#978)#985
Conversation
…BLED) Sets EARNINGS_INDEX_ENABLED=true in top-level + env.production vars (mirrors TENERO_REFRESH_ENABLED), omitted from env.preview so preview never indexes against the shared production D1/Hiro quota. Verified working first via a forced admin sweep: 25 agents, 31 Hiro calls, 116 earning rows / ~$1.6k, 6 self_funded exclusions, idempotent re-runs. The 30-min cron walks the full ~1k roster (~20h first pass) then runs cheap incremental cycles.
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
landing-page | 3a889cf | Commit Preview URL Branch Preview URL |
Jun 08 2026, 09:22 AM |
arc0btc
left a comment
There was a problem hiding this comment.
Enables the earnings indexer cron by setting EARNINGS_INDEX_ENABLED=true in top-level and env.production — intentionally omitted from env.preview to protect shared prod D1/Hiro quota.
What looks good:
- The pre-merge manual sweep is exactly the right gate here: 25 agents, 31 Hiro calls (≈1.2/agent confirms the join-date floor is doing its job), idempotency verified via
alreadyKnown: 92on re-run. That's a complete pre-flight. - Mirrors the established
TENERO_REFRESH_ENABLEDpattern — consistent with the repo's flag convention. - Preview env exclusion is correct: preview builds should never index against shared production D1/Hiro quota, and omission (rather than
false) is the right approach since a missing env var is easier to audit than a stalefalse. - The circuit-breaker from PR #958 is already in place — Hiro call storms during the ~20h backfill window are covered.
[nit] The inline comment on line 54 reads Ships off; flip to "true" to start indexing but the value is already "true". That comment was accurate when the flag was being introduced as off-by-default; now that this PR is enabling it, the comment is misleading. Consider updating to something like Enabled: 30-min earnings indexer cron sweep (issue #978). or just removing it since the PR description and issue #978 already document the history.
Code quality notes:
- The second block (line 158,
env.production) correctly mirrors the top-level vars — no gaps there.
Operational note: The 30-min cron cadence against ~1k roster with bounded incremental cycles after backfill is a reasonable pattern. The backfill math (~20h at 25 agents/tick) is realistic and won't spike Hiro quota in a way the circuit-breaker can't absorb.
Flips the earnings indexer on by setting
EARNINGS_INDEX_ENABLED=true(top-level +env.production, omitted fromenv.previewso preview never indexes against shared prod D1/Hiro). Mirrors theTENERO_REFRESH_ENABLEDpattern.Verified working before enabling
Ran a forced admin sweep against prod (
POST /api/admin/scheduler?action=refresh&task=earnings) after applying migrations 020–022:self_fundedexclusions (anti-gaming fired), 186unclassifiedcorrectly excludedalreadyKnown: 92on re-run → idempotency confirmedWhat happens on merge/deploy
The 30-min cron sweep starts: 25 agents/tick → ~20h for the first full backfill of the ~1k roster, then cheap incremental cycles (only-new-txs per agent, often zero work). Monitor via
GET /api/admin/scheduler→.status.lastEarningsResult.Flip back off any time by reverting this (or
wrangler secret put). Part of #978.