This commit is contained in:
shoopea 2019-06-14 11:32:42 +08:00
parent 7997a82986
commit c928aa323a
2 changed files with 3 additions and 2 deletions

2
def.go
View File

@ -45,4 +45,6 @@ const (
cmdParseModePlain = 1 cmdParseModePlain = 1
cmdParseModeMarkDown = 2 cmdParseModeMarkDown = 2
cmdParseModeHTML = 3 cmdParseModeHTML = 3
KeepAliveHeartBeatSeconds = 5
) )

3
mq.go
View File

@ -86,7 +86,6 @@ func MQReceiveMsgWorker(id int, cmd chan<- TGCommand) {
err = json.Unmarshal(d.Body, &c) err = json.Unmarshal(d.Body, &c)
logOnError(err, "MQReceiveMsgWorker["+strconv.Itoa(id)+"] : Can't unmarshal.\n"+string(d.Body)) logOnError(err, "MQReceiveMsgWorker["+strconv.Itoa(id)+"] : Can't unmarshal.\n"+string(d.Body))
if err == nil { if err == nil {
log.Printf("****************************** New MQ message ******************************\n%s\n****************************************************************************\n", string(d.Body))
cmd <- c cmd <- c
} }
} }
@ -139,7 +138,7 @@ func MQKeepAliveWorker() {
logOnError(err, "MQKeepAliveWorker : Publishing message.") logOnError(err, "MQKeepAliveWorker : Publishing message.")
} }
} }
time.Sleep(time.Minute) time.Sleep(KeepAliveHeartBeatSeconds * time.Second)
} }
log.Printf("MQKeepAliveWorker : Closing.") log.Printf("MQKeepAliveWorker : Closing.")
} }