test
This commit is contained in:
parent
362800da22
commit
37945c5b60
45
workers.go
45
workers.go
@ -168,20 +168,39 @@ func MQKeepAliveWorker() {
|
|||||||
k := v.(*MQKeepAlive)
|
k := v.(*MQKeepAlive)
|
||||||
k.Date = x.Date
|
k.Date = x.Date
|
||||||
} else {
|
} else {
|
||||||
clt := MQClient{}
|
clt := MQClient{
|
||||||
clt.Connection, err = amqp.Dial("amqp://" + cfg.Rabbit.User + ":" + cfg.Rabbit.Password + "@" + cfg.Rabbit.Host + "/" + x.Queue)
|
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")
|
logOnError(err, "MQKeepAliveWorker : Failed to connect to RabbitMQ")
|
||||||
clt.Channel, err = clt.Connection.Channel()
|
if err != nil {
|
||||||
logOnError(err, "MQKeepAliveWorker : Failed to open a channel")
|
clt.Connection.Close()
|
||||||
clt.Queue, err = clt.Channel.QueueDeclare(
|
} else {
|
||||||
"msg", // name
|
clt.Channel, err = clt.Connection.Channel()
|
||||||
false, // durable
|
logOnError(err, "MQKeepAliveWorker : Failed to open a channel")
|
||||||
false, // delete when unused
|
if err != nil {
|
||||||
false, // exclusive
|
clt.Channel.Close()
|
||||||
false, // no-wait
|
clt.Connection.Close()
|
||||||
nil, // arguments
|
} else {
|
||||||
)
|
clt.Queue, err = clt.Channel.QueueDeclare(
|
||||||
logOnError(err, "MQKeepAliveWorker : Failed to declare a queue")
|
"msg", // name
|
||||||
|
false, // durable
|
||||||
|
false, // delete when unused
|
||||||
|
false, // exclusive
|
||||||
|
false, // no-wait
|
||||||
|
nil, // arguments
|
||||||
|
)
|
||||||
|
logOnError(err, "MQKeepAliveWorker : Failed to declare a queue")
|
||||||
|
if err != nil {
|
||||||
|
clt.Channel.Close()
|
||||||
|
clt.Connection.Close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
clientsKeepAlive.Store(x.UserID64, &x)
|
clientsKeepAlive.Store(x.UserID64, &x)
|
||||||
clientsQueue[x.UserID64] = &clt
|
clientsQueue[x.UserID64] = &clt
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user