2 Commits

Author SHA1 Message Date
bbe56247bd v5.2.3
Some checks failed
CI / Type Check & Lint (push) Failing after 7s
CI / Build Test (Current Platform) (push) Failing after 6s
CI / Build All Platforms (push) Failing after 5s
Publish to npm / npm-publish (push) Failing after 7s
Release / build-and-release (push) Failing after 6s
2026-02-26 16:58:06 +00:00
71a0ec3202 fix(delivery): prevent throttle reset timer from firing after stop and avoid scheduling duplicate timers 2026-02-26 16:58:06 +00:00
4 changed files with 22 additions and 4 deletions

View File

@@ -1,5 +1,12 @@
# Changelog # Changelog
## 2026-02-26 - 5.2.3 - fix(delivery)
prevent throttle reset timer from firing after stop and avoid scheduling duplicate timers
- add throttleResetTimer property to track scheduled throttle-reset timeout
- clear throttleResetTimer when stopping to prevent it firing after shutdown
- clear existing throttleResetTimer before scheduling a new one and null it when fired to avoid duplicate timers and potential leaks
## 2026-02-12 - 5.2.2 - fix(deps) ## 2026-02-12 - 5.2.2 - fix(deps)
bump dependencies: @push.rocks/smartrust to ^1.2.1, lru-cache to ^11.2.6 bump dependencies: @push.rocks/smartrust to ^1.2.1, lru-cache to ^11.2.6

View File

@@ -1,6 +1,6 @@
{ {
"name": "@push.rocks/smartmta", "name": "@push.rocks/smartmta",
"version": "5.2.2", "version": "5.2.3",
"description": "A high-performance, enterprise-grade Mail Transfer Agent (MTA) built from scratch in TypeScript with Rust acceleration.", "description": "A high-performance, enterprise-grade Mail Transfer Agent (MTA) built from scratch in TypeScript with Rust acceleration.",
"keywords": [ "keywords": [
"mta", "mta",

View File

@@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@push.rocks/smartmta', name: '@push.rocks/smartmta',
version: '5.2.2', version: '5.2.3',
description: 'A high-performance, enterprise-grade Mail Transfer Agent (MTA) built from scratch in TypeScript with Rust acceleration.' description: 'A high-performance, enterprise-grade Mail Transfer Agent (MTA) built from scratch in TypeScript with Rust acceleration.'
} }

View File

@@ -108,6 +108,7 @@ export class MultiModeDeliverySystem extends EventEmitter {
private activeDeliveries: Set<string> = new Set(); private activeDeliveries: Set<string> = new Set();
private running: boolean = false; private running: boolean = false;
private throttled: boolean = false; private throttled: boolean = false;
private throttleResetTimer: ReturnType<typeof setTimeout> | null = null;
private rateLimitLastCheck: number = Date.now(); private rateLimitLastCheck: number = Date.now();
private rateLimitCounter: number = 0; private rateLimitCounter: number = 0;
private emailServer?: UnifiedEmailServer; private emailServer?: UnifiedEmailServer;
@@ -211,7 +212,13 @@ export class MultiModeDeliverySystem extends EventEmitter {
} }
this.running = false; this.running = false;
// Clear throttle reset timer to prevent it firing after stop
if (this.throttleResetTimer) {
clearTimeout(this.throttleResetTimer);
this.throttleResetTimer = null;
}
// Wait for active deliveries to complete // Wait for active deliveries to complete
if (this.activeDeliveries.size > 0) { if (this.activeDeliveries.size > 0) {
logger.log('info', `Waiting for ${this.activeDeliveries.size} active deliveries to complete`); logger.log('info', `Waiting for ${this.activeDeliveries.size} active deliveries to complete`);
@@ -776,7 +783,11 @@ export class MultiModeDeliverySystem extends EventEmitter {
// Schedule throttle reset // Schedule throttle reset
const resetDelay = 60000 - elapsed; const resetDelay = 60000 - elapsed;
setTimeout(() => { if (this.throttleResetTimer) {
clearTimeout(this.throttleResetTimer);
}
this.throttleResetTimer = setTimeout(() => {
this.throttleResetTimer = null;
this.throttled = false; this.throttled = false;
this.rateLimitLastCheck = Date.now(); this.rateLimitLastCheck = Date.now();
this.rateLimitCounter = 0; this.rateLimitCounter = 0;