From 83f0683ebd3e82d02b805300e1c1c2f3077f3ec9 Mon Sep 17 00:00:00 2001 From: u Date: Tue, 24 Aug 2021 15:49:34 +0800 Subject: [PATCH] fix --- core.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/core.go b/core.go index 0456e1c..4eebdc3 100644 --- a/core.go +++ b/core.go @@ -1,12 +1,10 @@ package time_arrow import ( - "encoding/json" "fmt" "log" "sort" "strings" - "sync" "time" "github.com/google/uuid" @@ -119,7 +117,7 @@ func isInDayOfMonth(t time.Time, ta TimeArrow) bool { return false } -var isInTimeOfDayCacheBool sync.Map +// var isInTimeOfDayCacheBool sync.Map func isInTimeOfDay(t time.Time, ta TimeArrow) bool { @@ -130,8 +128,8 @@ func isInTimeOfDay(t time.Time, ta TimeArrow) bool { tfdate := t.Format("2006-01-02 15:04:05") var err error - tmp, err := json.Marshal(ta.TimesOnDay) - mainKey := fmt.Sprintf("[%s][%s]", tfdate, string(tmp)) + // tmp, err := json.Marshal(ta.TimesOnDay) + // mainKey := fmt.Sprintf("[%s][%s]", tfdate, string(tmp)) // value, ok := isInTimeOfDayCacheBool.Load(mainKey) // if ok && err == nil { @@ -199,11 +197,11 @@ func isInTimeOfDay(t time.Time, ta TimeArrow) bool { } if (t.After(startTime) || t.Equal(startTime)) && t.Before(endTime) { - isInTimeOfDayCacheBool.Store(mainKey, 3) + // isInTimeOfDayCacheBool.Store(mainKey, 3) return true } } - isInTimeOfDayCacheBool.Store(mainKey, 4) + // isInTimeOfDayCacheBool.Store(mainKey, 4) return false }