There is a background flush process that was added for this precise reason.
In broker.conf ---- # How frequently to flush the cursor positions that were accumulated due to rate limiting. (seconds). # Default is 60 seconds managedLedgerCursorPositionFlushSeconds=60 -- Matteo Merli <matteo.me...@gmail.com> On Wed, Jun 15, 2022 at 8:45 AM Asaf Mesika <asaf.mes...@gmail.com> wrote: > > Hi, > > In the Managed Cursor implementation, I saw that the position state is > persisted in the ledger whenever a user calls acknowledge, be it individual > or cumulative. > > For performance reasons there is a rate limiter, defaulting to 1 persist > action per second. > > The bug: > 17:00:00.003 - user ack a single message --> state it written to ledger > 17:00:00.004 - 17:00:00.400 - use acks a single message 100 times. > nothing happens after that on that subscription. > > 18:00 - machine crashed. > You "lost" the state hence 100 messages have to be redelivered. > > I was wondering if it makes sense to add a timeout - say 10sec. If nothing > happens to the subscription, flush the state after 10sec if it's dirty. > > WDYT?