mirror of https://github.com/minio/minio.git
Fix rabbitmq reconnect problem (#3778)
This commit is contained in:
parent
9eb8e375c5
commit
0a905e1a8a
|
@ -18,6 +18,7 @@ package cmd
|
|||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"net"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/streadway/amqp"
|
||||
|
@ -87,7 +88,14 @@ func (q amqpConn) Fire(entry *logrus.Entry) error {
|
|||
ch, err := q.Connection.Channel()
|
||||
if err != nil {
|
||||
// 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
|
||||
}
|
||||
// Attempt to connect again.
|
||||
|
|
Loading…
Reference in New Issue