cargo build warns on backend/src/jobs/backfill.rs:
warning: value assigned to `uncommitted_events` is never read
--> src/jobs/backfill.rs:304:17
304 | uncommitted_events += events.len() as u64;
...
314 | uncommitted_events = 0;
and separately:
warning: unused variable: `last_ledger`
--> src/jobs/backfill.rs:349:17
349 | ... let last_ledger = current - 1; // It was updated before the break, wait, `current` is the next ledger to fetch, but the last ...
The inline comment on the last_ledger line ("wait, current is the next ledger to fetch,
but the last...") reads like an unfinished thought left mid-debugging, and the compiler
confirms uncommitted_events is incremented and then immediately overwritten with 0 before
ever being read — meaning whatever checkpoint/batch-commit logic this counter was meant to
drive is not actually running. For a ledger backfill job, a checkpoint counter that's
silently dead code could mean partial batches aren't being flushed/committed at the intended
cadence, which matters for both correctness (data loss on crash mid-backfill) and performance
(committing too rarely or too often).
Acceptance criteria:
cargo buildwarns onbackend/src/jobs/backfill.rs:and separately:
The inline comment on the
last_ledgerline ("wait,currentis the next ledger to fetch,but the last...") reads like an unfinished thought left mid-debugging, and the compiler
confirms
uncommitted_eventsis incremented and then immediately overwritten with0beforeever being read — meaning whatever checkpoint/batch-commit logic this counter was meant to
drive is not actually running. For a ledger backfill job, a checkpoint counter that's
silently dead code could mean partial batches aren't being flushed/committed at the intended
cadence, which matters for both correctness (data loss on crash mid-backfill) and performance
(committing too rarely or too often).
Acceptance criteria:
uncommitted_eventswassupposed to gate (a periodic
db.commit()/checkpoint write, a progress log line, abatch-size cap?)
firing) is actually a problem in practice, or if a different mechanism already covers it
remove the dead variable and clean up the stale comment if it turns out to be genuinely
unnecessary
last_ledgerunused-variable warning the same way (understand its intent,not just underscore-prefix it)