This commit is contained in:
shoopea 2019-06-28 16:05:59 +08:00
parent 64f9f08666
commit 3731e36e5f

View File

@ -26,13 +26,14 @@ func MQGetMsgWorker(id int, msgs chan<- ChatWarsMessage) {
}
conn, err := amqp.Dial("amqp://" + c.User + ":" + c.Password + "@" + c.Host + "/" + c.Path)
c.Connection = conn
logOnError(err, "MQGetMsgWorker["+strconv.Itoa(id)+"] : Failed to connect to RabbitMQ")
if err != nil {
conn.Close()
c.Connection.Close()
time.Sleep(15 * time.Second)
} else {
ch, err := conn.Channel()
ch, err := c.Connection.Channel()
logOnError(err, "MQGetMsgWorker["+strconv.Itoa(id)+"] : Failed to open a channel")
if err != nil {
ch.Close()