fix(07): WR-01 close nodemailer transport in finally to prevent pool leak
Tessera CI/CD / Lint & Type Check (push) Waiting to run
Tessera CI/CD / Tests (push) Blocked by required conditions
Tessera CI/CD / Build & Deploy (push) Blocked by required conditions

Each sendExportEmail call created a new nodemailer transport which was never
closed, leaving the internal SMTP connection pool alive. With 3-retry backoff,
up to 3 leaked transports per invoice accumulate over time and can exhaust OS
socket limits. Add transport.close() in a finally block.
This commit is contained in:
2026-06-27 17:21:01 +02:00
parent cb0d378ded
commit ded652382d
+5
View File
@@ -103,6 +103,11 @@ export class DkvMailService {
);
// RETHROW — caller (DkvService) handles exponential backoff retries (D-16)
throw error;
} finally {
// Always close the transport to release the SMTP connection pool (WR-01).
// Without this, repeated sends (especially with retry backoff) accumulate
// open connections and can exhaust OS socket limits.
transport.close();
}
}
}