mirror of
https://github.com/containrrr/watchtower.git
synced 2025-09-21 21:30:48 +02:00
Use CreateSender instead of calling Send multiple times
This commit is contained in:
parent
59ce378a35
commit
5869bc52aa
1 changed files with 5 additions and 3 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue