test version

This commit is contained in:
shoopea 2020-02-05 18:43:17 +08:00
parent baa7af44ee
commit db5e6b19d6
3 changed files with 4 additions and 1 deletions

2
def.go
View File

@ -80,6 +80,7 @@ type MQClient struct {
type ChirpClient struct {
HeartBeat time.Time `json:"heart_beat"`
Login string `json:"nickname"`
Build string `json:"build"`
Active bool `json:"active"`
TGUserID64 int64 `json:"tg_user_id"`
MQ MQClient `json:"mq"`
@ -100,6 +101,7 @@ type MQKeepAlive struct {
Nickname string `json:"nick"`
Queue string `json:"queue"`
Date time.Time `json:"date"`
Build string `json:"build"`
}
type TGCommand struct {

View File

@ -115,7 +115,7 @@ func main() {
u := tb.User{
ID: int(cfg.Bot.Admin),
}
bot.Send(&u, fmt.Sprintf("Bot restarted (%s)", githash))
bot.Send(&u, fmt.Sprintf("Started (%s - %s)", githash, buildstamp))
cr = startCron()

View File

@ -165,6 +165,7 @@ func MQKeepAliveWorker() {
// outdated keep-alive coming from client
} else if clt, ok := getLockedClient(x.TGUserID64, true); ok {
clt.HeartBeat = x.Date
clt.Build = x.Build
if clt.Active {
//log.Printf("MQKeepAliveWorker : Client %s (%d) already active.\n", clt.Login, clt.TGUserID64)
clt.Mux.Unlock()