Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: properly close HTTP responses after sending each email
This change extracts per-email sending logic into a helper function for which proper resource closing can be performed. Previously it invoke defer res.Body.Close in a for-loop but Go's specifications and operations dictate that the defer will only be invoked when the surrounding function is returning or panicking: this means then that if very many emails are being sent, that risks potential resource exhaustion because so many connections won't be closed yet nor can they be garbage collected. Fixes cds-snc#13
- Loading branch information