diff --git a/revid/senders.go b/revid/senders.go index 794c4940..4a96ad2f 100644 --- a/revid/senders.go +++ b/revid/senders.go @@ -57,6 +57,7 @@ type Sender interface { type multiSender struct { owner *Revid senders []loadSender + retry bool } // newMultiSender returns a pointer to a new multiSender. @@ -69,28 +70,23 @@ func newMultiSender(owner *Revid, senders []loadSender) *multiSender { // sends we notify the current sender to take any required actions and then try // the send again. func (s *multiSender) Write(d []byte) (int, error) { - for i, sender := range s.senders { + for _, sender := range s.senders { sender.load(d) - err := sender.send() - if err != nil { - s.owner.config.Logger.Log(logger.Warning, "send failed", "output", i, "error", err) - s.handleFail(sender, err) - if s.owner.config.SendRetry { - for { - if !s.owner.IsRunning() { - sender.release() - return 0, err - } - err = sender.send() - if err == nil { - break - } - s.handleFail(sender, err) - } + for s.owner.IsRunning() { + err := sender.send() + if err != nil { + s.handleFail(sender, err) + } + if err == nil || !s.retry { + break } } + } + + for _, sender := range s.senders { sender.release() } + return len(d), nil }