Refused SMTP connection skips the remaining integrations
When a check goes down, its email integration is notified before another integration (we use both SMTP and a webhook), and if the SMTP server refuses the TCP connection (server down or blocked by firewall), the other integration (webhook) is never notified for that alert.
If the check has only the webhook integration, or the SMTP server accepts the connection, the webhook fires normally.
Traceback from the container log:
File "/opt/healthchecks/hc/api/management/commands/sendalerts.py", line 43, in notify
File "/opt/healthchecks/hc/api/models.py", line 1172, in notify
File "/opt/healthchecks/hc/integrations/email/transport.py", line 79, in notify
File "/opt/healthchecks/hc/lib/emails.py", line 105, in alert
File "/opt/healthchecks/hc/lib/emails.py", line 81, in send
File "/opt/healthchecks/hc/lib/emails.py", line 25, in run
ConnectionRefusedError: [Errno 111] Connection refusedAlso, if the SMTP server accepts the TCP connection but does not answer (220...), the email notification blocks in the sendalerts worker. Alerts of unrelated checks, even ones that have only a webhook integration, are not sent until the SMTP connection is closed. Maybe some kind of timeout logic is needed here, I've not investigated further.
Happy to provide more details if needed.
Source: healthchecks/healthchecks