fix(07): WR-01 close nodemailer transport in finally to prevent pool leak
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:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user