0x2142 / frigate-notify

Event notifications for a standalone Frigate NVR instance
https://frigate-notify.0x2142.com/
MIT License
78 stars 6 forks source link

Improvement: Add HTTP retries when the remote side does not respond #103

Closed freefd closed 2 weeks ago

freefd commented 2 months ago

I've just faced the rare but painful side effect when the HTTP transport can do retransmission on the L3 but has no retransmissions for L4:

2024/06/23 17:40:35 +0000 INF ../tmp/src/notifier/telegram.go:69 > Alert sent event_id=1719153634.438606-w2iy47 provider=Telegram
2024/06/23 17:40:37 +0000 WRN ../tmp/src/notifier/nfty.go:64 > Unable to send alert error="Post \"https://ntfy.domain.tld/topicname\": dial tcp 192.168.xxx.xxx:443: connect: no route to host" event_id=1719153634.438606-w2iy47 provider=Ntfy

That happened due to reverse proxy pod in front of Ntfy was restarting and therefore unavailable.

Is it possible to add to both functions from https://github.com/0x2142/frigate-notify/blob/main/util/httpclient.go some reasonable retries, let's say 5 or even 6. So the maximum delay could be about 1 minute (6 retries * 10 seconds timeout).

Whether this needs to be configurable or not - idk.

Thank you.

0x2142 commented 2 months ago

Interesting - Thanks for reporting this. Should be easy enough to fix, I'll add it to the list!

freefd commented 2 weeks ago

Work like a charm, thanks a lot.

0x2142 commented 2 weeks ago

Awesome. Glad to hear it and thanks for the feedback!