test reload rules for offline client
This commit is contained in:
parent
140b420652
commit
3709bbc1f9
@ -731,7 +731,9 @@ func TGCmdWorker(id int, b *tb.Bot, cmds <-chan TGCommand) {
|
|||||||
|
|
||||||
func MQTidyKeepAliveWorker() {
|
func MQTidyKeepAliveWorker() {
|
||||||
//log.Printf("MQTidyKeepAliveWorker : Starting.")
|
//log.Printf("MQTidyKeepAliveWorker : Starting.")
|
||||||
|
var reloadRules bool
|
||||||
for true {
|
for true {
|
||||||
|
reloadRules = false
|
||||||
t := time.Now()
|
t := time.Now()
|
||||||
muxClients.Lock()
|
muxClients.Lock()
|
||||||
for id, clt := range clients {
|
for id, clt := range clients {
|
||||||
@ -756,6 +758,7 @@ func MQTidyKeepAliveWorker() {
|
|||||||
}
|
}
|
||||||
TGCmdQueue <- cmd
|
TGCmdQueue <- cmd
|
||||||
clt.Active = false
|
clt.Active = false
|
||||||
|
reloadRules = true
|
||||||
} else if clt.Active {
|
} else if clt.Active {
|
||||||
//log.Printf("MQTidyKeepAliveWorker : Client %s is active.\n", clt.Login)
|
//log.Printf("MQTidyKeepAliveWorker : Client %s is active.\n", clt.Login)
|
||||||
} else {
|
} else {
|
||||||
@ -764,6 +767,12 @@ func MQTidyKeepAliveWorker() {
|
|||||||
clt.Mux.Unlock()
|
clt.Mux.Unlock()
|
||||||
}
|
}
|
||||||
muxClients.Unlock()
|
muxClients.Unlock()
|
||||||
|
if reloadRules {
|
||||||
|
log.Printf("Offline client, reloading rules ..\n")
|
||||||
|
resetMsgParsingRules()
|
||||||
|
msgParsingRules, err = loadMsgParsingRules()
|
||||||
|
logOnError(err, "MQTidyKeepAliveWorker : message parsing rules")
|
||||||
|
}
|
||||||
time.Sleep(time.Until(t.Add(time.Second)))
|
time.Sleep(time.Until(t.Add(time.Second)))
|
||||||
}
|
}
|
||||||
log.Printf("MQTidyKeepAliveWorker : Closing.")
|
log.Printf("MQTidyKeepAliveWorker : Closing.")
|
||||||
|
Loading…
Reference in New Issue
Block a user