From 944180f9ccdfa1fe9fdd908f6211f37b6bf6a83d Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Wed, 5 Jul 2023 19:57:32 +0800 Subject: [PATCH] :art: Change rhy result cache time to 24 hours if on the docker --- kernel/util/rhy.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/kernel/util/rhy.go b/kernel/util/rhy.go index b3937a1b5..4620bf5dd 100644 --- a/kernel/util/rhy.go +++ b/kernel/util/rhy.go @@ -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 }