This commit is contained in:
Liang Ding 2023-05-05 23:12:52 +08:00
parent 953e2fa90b
commit a219cf52f5
No known key found for this signature in database
GPG Key ID: 136F30F901A2231D

View File

@ -262,7 +262,7 @@ func ThemeJSON(themeDirName string) (ret *Theme, err error) {
return return
} }
var cachedStageIndex map[string]*StageIndex var cachedStageIndex = map[string]*StageIndex{}
var stageIndexCacheTime int64 var stageIndexCacheTime int64
var stageIndexLock = sync.Mutex{} var stageIndexLock = sync.Mutex{}
@ -276,7 +276,7 @@ func getStageIndex(pkgType string) (ret *StageIndex, err error) {
defer stageIndexLock.Unlock() defer stageIndexLock.Unlock()
now := time.Now().Unix() now := time.Now().Unix()
if 3600 >= now-stageIndexCacheTime { if 3600 >= now-stageIndexCacheTime && nil != cachedStageIndex[pkgType] {
ret = cachedStageIndex[pkgType] ret = cachedStageIndex[pkgType]
return return
} }