From 51a9509f7ded57e90e7b888e748e3bd1f717f81d Mon Sep 17 00:00:00 2001 From: u Date: Tue, 24 Aug 2021 15:31:15 +0800 Subject: [PATCH] fix --- core.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/core.go b/core.go index 75bb1a8..3eb5dc8 100644 --- a/core.go +++ b/core.go @@ -131,9 +131,14 @@ func isInTimeOfDay(t time.Time, ta TimeArrow) bool { mainKey := fmt.Sprintf("[%s][%s]", tfdate, strings.Join(ta.TimesOnDay, "|")) value, ok := isInTimeOfDayCacheBool.Load(mainKey) if ok { - ret, ok := value.(bool) + ret, ok := value.(int) if ok { - return ret + if ret == 1 { + return true + } + if ret == 2 { + return false + } } } @@ -193,11 +198,11 @@ func isInTimeOfDay(t time.Time, ta TimeArrow) bool { } if (t.After(startTime) || t.Equal(startTime)) && t.Before(endTime) { - isInTimeOfDayCacheBool.Store(mainKey, true) + isInTimeOfDayCacheBool.Store(mainKey, 1) return true } } - isInTimeOfDayCacheBool.Store(mainKey, false) + isInTimeOfDayCacheBool.Store(mainKey, 2) return false }