This commit is contained in:
shoopea 2019-05-17 15:07:47 +08:00
parent 75efdb2e34
commit 4a16193666

View File

@ -287,18 +287,18 @@ func MQTidyKeepAliveWorker() {
log.Printf("MQTidyKeepAliveWorker : Starting.")
for true {
t := time.Now()
for k, v := range clientsQueues {
for _, v := range clientsQueues {
if v.Date.Add(90 * time.Second).Before(time.Now()) {
c := TGCommand{
Type: commandSendMsg,
ToChatID64: x.UserID64,
ToChatID64: v.UserID64,
Text: "Timeout.",
}
TGCmdQueue <- c
delete(clientsQueues, x.UserID64)
delete(clientsQueues, v.UserID64)
}
}
time.Sleep(time.Until(t.Add(time.Minute)))
time.Sleep(time.Until(t.Add(time.Second)))
}
log.Printf("MQTidyKeepAliveWorker : Closing.")
}