|
|
@ -18,6 +18,7 @@ package cmd |
|
|
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
import ( |
|
|
|
"io/ioutil" |
|
|
|
"io/ioutil" |
|
|
|
|
|
|
|
"net" |
|
|
|
|
|
|
|
|
|
|
|
"github.com/Sirupsen/logrus" |
|
|
|
"github.com/Sirupsen/logrus" |
|
|
|
"github.com/streadway/amqp" |
|
|
|
"github.com/streadway/amqp" |
|
|
@ -87,7 +88,14 @@ func (q amqpConn) Fire(entry *logrus.Entry) error { |
|
|
|
ch, err := q.Connection.Channel() |
|
|
|
ch, err := q.Connection.Channel() |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
// Any other error other than connection closed, return.
|
|
|
|
// Any other error other than connection closed, return.
|
|
|
|
if err != amqp.ErrClosed { |
|
|
|
isClosedErr := false |
|
|
|
|
|
|
|
if neterr, ok := err.(*net.OpError); ok && |
|
|
|
|
|
|
|
neterr.Err.Error() == "use of closed network connection" { |
|
|
|
|
|
|
|
isClosedErr = true |
|
|
|
|
|
|
|
} else if err == amqp.ErrClosed { |
|
|
|
|
|
|
|
isClosedErr = true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if !isClosedErr { |
|
|
|
return err |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|
// Attempt to connect again.
|
|
|
|
// Attempt to connect again.
|
|
|
|