fix(token-usage): serialize background pauses, close pacing gaps
Review follow-ups on the shared background ledger: - Pauses are now serialized reservations (paused_until): concurrent sweep and flush settlements queue their pauses instead of sleeping them overlapped, so combined background CPU holds one duty cycle rather than one per thread — and a capped flush sleep forgives nothing, since the reservation stands for the next segment. - flush_metrics charges only its store segment; the inner drain paces itself, and wrapping it billed the drain's own pauses as fresh work. - The paced drain cap counts iterations, not uploads, and the filtered-records skip path pays its pause too — a backlog of malformed or excluded records no longer loops unpaced to the 30s deadline. - The backlog-drained reconcile runs after notify tasks as well (one SELECT when their inline pass left nothing): flags left by a failed inline reconcile no longer wait for the next 30-minute sweep tick. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
S
Sasha Varlamov committed
d5543215d09bf5c64b525510a84e09594bac7394
Parent: 95b6a0d