test
This commit is contained in:
parent
05f7aa05f2
commit
b205f12a2e
10
workers.go
10
workers.go
@ -285,9 +285,9 @@ func MQKeepAliveWorker() {
|
|||||||
clt := MQClient{}
|
clt := MQClient{}
|
||||||
clt.Connection, err = amqp.Dial("amqp://" + cfg.Rabbit.User + ":" + cfg.Rabbit.Password + "@" + cfg.Rabbit.Host + "/" + x.Queue)
|
clt.Connection, err = amqp.Dial("amqp://" + cfg.Rabbit.User + ":" + cfg.Rabbit.Password + "@" + cfg.Rabbit.Host + "/" + x.Queue)
|
||||||
logOnError(err, "MQKeepAliveWorker : Failed to connect to RabbitMQ")
|
logOnError(err, "MQKeepAliveWorker : Failed to connect to RabbitMQ")
|
||||||
clt.Channel, err = clt.conn.Channel()
|
clt.Channel, err = clt.Connection.Channel()
|
||||||
logOnError(err, "MQKeepAliveWorker : Failed to open a channel")
|
logOnError(err, "MQKeepAliveWorker : Failed to open a channel")
|
||||||
clt.Queue, err = ch.QueueDeclare(
|
clt.Queue, err = clt.Channel.QueueDeclare(
|
||||||
"msg", // name
|
"msg", // name
|
||||||
false, // durable
|
false, // durable
|
||||||
false, // delete when unused
|
false, // delete when unused
|
||||||
@ -325,9 +325,9 @@ func MQTidyKeepAliveWorker() {
|
|||||||
t := time.Now()
|
t := time.Now()
|
||||||
for _, v := range clientsKeepAlive {
|
for _, v := range clientsKeepAlive {
|
||||||
if v.Date.Add(90 * time.Second).Before(time.Now()) {
|
if v.Date.Add(90 * time.Second).Before(time.Now()) {
|
||||||
msgs, err := clt[v.UserID64].Channel.QueuePurge(clt[v.UserID64].Queue.Name, false)
|
msgs, err := clientsQueue[v.UserID64].Channel.QueuePurge(clt[v.UserID64].Queue.Name, false)
|
||||||
_ = clt[v.UserID64].Channel.Close()
|
_ = clientsQueue[v.UserID64].Channel.Close()
|
||||||
_ = clt[v.UserID64].Connection.Close()
|
_ = clientsQueue[v.UserID64].Connection.Close()
|
||||||
c := TGCommand{
|
c := TGCommand{
|
||||||
Type: commandSendMsg,
|
Type: commandSendMsg,
|
||||||
ToUserID64: v.UserID64,
|
ToUserID64: v.UserID64,
|
||||||
|
Loading…
Reference in New Issue
Block a user