From d49088de3b6aae343312b57e149893fc69c9c23a Mon Sep 17 00:00:00 2001 From: shoopea Date: Thu, 16 Jan 2020 14:17:33 +0800 Subject: [PATCH] test set busy --- client.go | 5 ++++- def.go | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/client.go b/client.go index 1341aa3..581d704 100644 --- a/client.go +++ b/client.go @@ -56,12 +56,15 @@ func getLockedRandomClient() (*ChirpClient, error) { func setClientBusy(userID64 int64, from time.Time, duration time.Duration) error { if clt, ok := getLockedClient(userID64, false); ok { + t := time.Now().UTC() + log.Printf("setClientBusy[%s] : now %s.\n", clt.Login, t.Format(timeFmt)) + log.Printf("setClientBusy[%s] : until %s.\n", clt.Login, from.UTC().Add(duration).Format(timeFmt)) if from.UTC().Add(duration).After(time.Now().UTC()) { clt.CWIdle = false clt.CWBusyUntil = from.UTC().Add(duration) log.Printf("setClientBusy[%s] : set for %s.\n", clt.Login, duration.String()) } else { - log.Printf("setClientBusy[%s] : not updated.\n", clt.Login) + log.Printf("setClientBusy[%s] : not updated (.\n", clt.Login) } clt.Mux.Unlock() return nil diff --git a/def.go b/def.go index e9f7e70..003e549 100644 --- a/def.go +++ b/def.go @@ -12,6 +12,7 @@ import ( const maxUnixTimestamp int64 = 2147483647 const chtwrsbotID64 int64 = 408101137 const angrybirbsbotID64 int64 = 833409972 +const timeFmt string = "2006-01-02T15:04:05+07:00" type Config struct { Telegram struct {