test
This commit is contained in:
parent
362800da22
commit
37945c5b60
23
workers.go
23
workers.go
@ -168,11 +168,24 @@ func MQKeepAliveWorker() {
|
||||
k := v.(*MQKeepAlive)
|
||||
k.Date = x.Date
|
||||
} else {
|
||||
clt := MQClient{}
|
||||
clt.Connection, err = amqp.Dial("amqp://" + cfg.Rabbit.User + ":" + cfg.Rabbit.Password + "@" + cfg.Rabbit.Host + "/" + x.Queue)
|
||||
clt := MQClient{
|
||||
User: cfg.Rabbit.User,
|
||||
Password: cfg.Rabbit.Password,
|
||||
Host: cfg.Rabbit.Host,
|
||||
Path: x.Queue,
|
||||
SSL: false,
|
||||
}
|
||||
clt.Connection, err = amqp.Dial("amqp://" + c.User + ":" + c.Password + "@" + c.Host + "/" + c.Path)
|
||||
logOnError(err, "MQKeepAliveWorker : Failed to connect to RabbitMQ")
|
||||
if err != nil {
|
||||
clt.Connection.Close()
|
||||
} else {
|
||||
clt.Channel, err = clt.Connection.Channel()
|
||||
logOnError(err, "MQKeepAliveWorker : Failed to open a channel")
|
||||
if err != nil {
|
||||
clt.Channel.Close()
|
||||
clt.Connection.Close()
|
||||
} else {
|
||||
clt.Queue, err = clt.Channel.QueueDeclare(
|
||||
"msg", // name
|
||||
false, // durable
|
||||
@ -182,6 +195,12 @@ func MQKeepAliveWorker() {
|
||||
nil, // arguments
|
||||
)
|
||||
logOnError(err, "MQKeepAliveWorker : Failed to declare a queue")
|
||||
if err != nil {
|
||||
clt.Channel.Close()
|
||||
clt.Connection.Close()
|
||||
}
|
||||
}
|
||||
}
|
||||
clientsKeepAlive.Store(x.UserID64, &x)
|
||||
clientsQueue[x.UserID64] = &clt
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user