nats-server icon indicating copy to clipboard operation
nats-server copied to clipboard

MaxAge and Recovery

Open biskit opened this issue 4 years ago • 3 comments
trafficstars

fileserver.go:recoverMsgs() on restart calls fs.expireMsgsOnRecover(). it only checks if there's anything to expire now. after that fs.startAgeChk() is called that sets the AfterFunc to MaxAge.

If MaxAge=12h and at 11h I restart the server, it will not find any messages to expire, and set the next run to 12h. After 23 hours of original start, it will catch up, provided one does not hit MaxStorage issues. It can also catchup if another restart happens after 1h.

The right thing to do on restart after expireMsgsOnRecover() would be to check for the oldest message, and set initial duration in fileserver.go:startAgeChk() to MaxAge-OldestMsg.

biskit avatar Oct 16 '21 23:10 biskit

Good idea.

derekcollison avatar Oct 17 '21 15:10 derekcollison

@derekcollison Do you know if this has been addressed?

bruth avatar Mar 16 '24 18:03 bruth

I have not made this change.

derekcollison avatar Mar 16 '24 19:03 derekcollison