From 7ad2f23f2195dc66a6bd9466b7e58aefc48c3759 Mon Sep 17 00:00:00 2001 From: u Date: Tue, 24 Aug 2021 15:56:17 +0800 Subject: [PATCH] fix --- core.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/core.go b/core.go index 1cd0b0d..432d577 100644 --- a/core.go +++ b/core.go @@ -5,6 +5,7 @@ import ( "log" "sort" "strings" + "sync" "time" "github.com/google/uuid" @@ -99,12 +100,21 @@ func isInWeekOfDay(t time.Time, ta TimeArrow) bool { return false } +var timeCompletionCache sync.Map + func timeCompletion(a string) string { + rets, ok := timeCompletionCache.Load(a) + if ok { + return rets.(string) + } + sc := strings.Split(a, ":") for len(sc) < 3 { sc = append(sc, "00") } - return strings.Join(sc, ":") + ret := strings.Join(sc, ":") + timeCompletionCache.Store(a, ret) + return ret } func isInDayOfMonth(t time.Time, ta TimeArrow) bool {