Taksh e6c2c1d21e Deliver mail cached after a peer was already served
sendCachedMessages is latched per peer by cachedMessagesSentToPeer, and
nothing ever removed a peer from that set. So a peer received whatever was
held for it on its first connection of the session, and every later
reconnection was refused at the top of the function. Mail queued while it
was away sat in the cache until it aged out.

The latch means "this peer has been handed everything we hold". Caching
new mail for that peer is exactly the event that stops being true, so
release it there. A reconnect with nothing new still sends nothing, which
is what the latch is for.

Also stops the periodic cleanup wiping both tracking sets outright.
Emptying them bounded memory by forgetting: deliveredMessages is what
keeps an already-delivered message from being queued again, and the peer
latch is what keeps a batch from being sent twice. Both are now
insertion-ordered and trimmed to their cap oldest-first.
2026-08-15 14:24:45 +05:30
..
2025-12-14 21:55:41 +07:00
2026-07-29 03:41:16 +02:00