This commit is contained in:
shoopea 2019-06-28 15:23:44 +08:00
parent 80b4027776
commit b98069f4ba

View File

@ -62,6 +62,7 @@ func MQGetMsgWorker(id int, msgs chan<- ChatWarsMessage) {
msgs <- x msgs <- x
} }
} }
log.Printf("MQGetMsgWorker[" + strconv.Itoa(id) + "] : Closing queue.\n")
s.Close() s.Close()
} }
@ -91,6 +92,7 @@ func MQKeepAliveWorker() {
log.Printf("MQKeepAliveWorker : Session address : %p.\n", &s) log.Printf("MQKeepAliveWorker : Session address : %p.\n", &s)
log.Printf("MQKeepAliveWorker : Connection address : %p.\n", &s.MQConnection) log.Printf("MQKeepAliveWorker : Connection address : %p.\n", &s.MQConnection)
log.Printf("MQKeepAliveWorker : Channel address : %p.\n", &s.MQChannel) log.Printf("MQKeepAliveWorker : Channel address : %p.\n", &s.MQChannel)
/*
q, err := s.MQChannel.QueueDeclare( q, err := s.MQChannel.QueueDeclare(
s.Queue, // name s.Queue, // name
false, // durable false, // durable
@ -109,6 +111,8 @@ func MQKeepAliveWorker() {
false, // no-wait false, // no-wait
nil, // args nil, // args
) )
for d := range m { for d := range m {
log.Printf("MQKeepAliveWorker : Received a message: %s", string(d.Body)) log.Printf("MQKeepAliveWorker : Received a message: %s", string(d.Body))
x := MQKeepAlive{} x := MQKeepAlive{}
@ -149,18 +153,13 @@ func MQKeepAliveWorker() {
TGCmdQueue <- c TGCmdQueue <- c
clientSendCWMsg(x.UserID64, `🏅Me`) clientSendCWMsg(x.UserID64, `🏅Me`)
/* clientSendCWMsg(x.UserID64, `/hero`)
c = TGCommand{ }
Type: commandSendMsg, }
FromUserID64: x.UserID64,
ToChatID64: userID64ChtWrsBot,
Text: `/hero`,
} }
MQTGCmdQueue <- c
*/ */
} s.Close()
} log.Printf("MQKeepAliveWorker : Closing queue.\n")
}
} }
log.Printf("MQKeepAliveWorker : Closing.") log.Printf("MQKeepAliveWorker : Closing.")