u 3 years ago
parent
commit
51a9509f7d
  1. 13
      core.go

13
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
}

Loading…
Cancel
Save