Automatic managed-ledger offload triggers create redundant retry work Coalesce automatic…
- User
Automatic managed-ledger offload triggers create redundant retry work
Coalesce automatic offload triggers while an automatic offload is running. There must be at most one active automatic run and at most one follow-up run when additional triggers arrive. A follow-up must still process newly eligible ledgers, and explicit/manual offload futures must retain their existing behavior.
Interface
No new public interfaces are introduced.
- Assistant
I'll locate the managed-ledger automatic offload trigger logic and how retries are scheduled today.
- Assistant
Implementing coalescing for automatic offload triggers: one active run, one follow-up, preserving manual offload behavior.
- Assistant
Fixing a stale follow-up timer edge case: cancel it on abort/completion and guard the scheduled follow-up runner.
- Assistant
Automatic offload triggers in
ManagedLedgerImplare now coalesced so concurrent ledger rollovers no longer each schedule their own 100ms retry loop.Problem
When automatic offload was already running (or the offload mutex was held), every
maybeOffloadInBackgroundcall scheduled its ownscheduledExecutorretry. Many rapid ledger rollovers meant many redundant timers and executor tasks.Solution
Automatic offload now uses a small coalescing state machine in
ManagedLedgerImpl:- One active automatic run —
automaticOffloadInProgressensures only one automatic offload lifecycle runs at a time. - One follow-up — additional triggers while a run is active set
automaticOffloadFollowUpPendinginstead of scheduling more work. When the current run finishes, at most one follow-up is executed to pick up newly eligible ledgers.
- One active automatic run —
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.