Use CreateSender instead of calling Send multiple times

pull/470/head
Maximilian Brandau 4 years ago
parent 59ce378a35
commit 5869bc52aa
No known key found for this signature in database
GPG Key ID: 6CBA8C2AC22BA157

@ -48,11 +48,13 @@ func (e *shoutrrrTypeNotifier) sendEntries(entries []*log.Entry) {
// Do the sending in a separate goroutine so we don't block the main process.
msg := e.buildMessage(entries)
go func() {
for _, url := range e.Urls {
err := shoutrrr.Send(url, msg)
router, _ := shoutrrr.CreateSender(e.Urls...)
errs := router.Send(msg, nil)
for i, err := range errs {
if err != nil {
// Use fmt so it doesn't trigger another notification.
fmt.Println("Failed to send notification via shoutrrr (url="+url+"): ", err)
fmt.Println("Failed to send notification via shoutrrr (url="+e.Urls[i]+"): ", err)
}
}
}()

Loading…
Cancel
Save