fix(mail): add periodic cleanup timers and proper shutdown handling for bounce manager and delivery queue; avoid mutating maps during iteration and prune stale rate-limiter stats to prevent memory growth

This commit is contained in:
2026-03-02 14:06:47 +00:00
parent b465b01790
commit 8851d61466
5 changed files with 82 additions and 23 deletions

View File

@@ -1,5 +1,13 @@
# Changelog
## 2026-03-02 - 5.3.1 - fix(mail)
add periodic cleanup timers and proper shutdown handling for bounce manager and delivery queue; avoid mutating maps during iteration and prune stale rate-limiter stats to prevent memory growth
- BounceManager: add cleanupInterval to periodically remove bounce records older than 7 days and log removals; add stop() to clear the interval and prevent leaks
- UnifiedDeliveryQueue: introduce cleanupTimer started in startProcessing() and cleared in stopProcessing(); cleanupOldItems now collects IDs first to avoid mutating the Map while iterating and logs cleaned items; shutdown now relies on stopProcessing to clear timers
- UnifiedRateLimiter: prune stale stats.byIp and stats.byPattern entries for IPs/patterns that no longer have active counters or blocks to reduce memory usage and keep stats accurate
- Auto-cleanup tasks log errors rather than throwing to avoid crashing processing loops
## 2026-02-26 - 5.3.0 - feat(mailer-bin)
use mimalloc as the global allocator for mailer-bin