This commit is contained in:
shoopea 2019-06-28 13:10:40 +08:00
parent 3957c8fe3c
commit 3091ddb3a6
2 changed files with 3 additions and 3 deletions

2
def.go
View File

@ -28,7 +28,7 @@ type MQSession struct {
Queue string
MQConnection *amqp.Connection
MQChannel *amqp.Channel
MQQueue *amqp.Queue
MQQueue amqp.Queue
MQDelivery <-chan amqp.Delivery
isConnected bool
}

View File

@ -316,13 +316,13 @@ func MQTGCmdWorker(id int, cmds <-chan TGCommand) {
logOnError(err, "MQTGCmdWorker["+strconv.Itoa(id)+"] : Marshal(c)")
if clientIsAlive(c.FromUserID64) {
err = clientsQueue[c.FromUserID64].Publish("application/json", j)
err = clientsQueue[c.FromUserID64].Publish("application/json", string(j))
logOnError(err, "MQTGCmdWorker["+strconv.Itoa(id)+"] : Publishing message.")
for err != nil && clientIsAlive(c.FromUserID64) {
clientsQueue[c.FromUserID64].Close()
time.Sleep(5 * time.Second)
clientsQueue[c.FromUserID64].Open()
err = clientsQueue[c.FromUserID64].Publish("application/json", j)
err = clientsQueue[c.FromUserID64].Publish("application/json", string(j))
}
} else {
err = nil