nats-server
nats-server copied to clipboard
MaxAge and Recovery
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.
Good idea.
@derekcollison Do you know if this has been addressed?
I have not made this change.