🎨 Change rhy result cache time to 24 hours if on the docker

This commit is contained in:
Daniel 2023-07-05 19:57:32 +08:00
parent 19ed48a05c
commit 944180f9cc
No known key found for this signature in database
GPG Key ID: 86211BA83DF03017

View File

@ -32,8 +32,13 @@ func GetRhyResult(force bool) (map[string]interface{}, error) {
rhyResultLock.Lock()
defer rhyResultLock.Unlock()
cacheDuration := int64(3600)
if ContainerDocker == Container {
cacheDuration = int64(3600 * 24)
}
now := time.Now().Unix()
if 3600 >= now-rhyResultCacheTime && !force && 0 < len(cachedRhyResult) {
if cacheDuration >= now-rhyResultCacheTime && !force && 0 < len(cachedRhyResult) {
return cachedRhyResult, nil
}