Skip to content

Commit

Permalink
修复 缓存重复初始化
Browse files Browse the repository at this point in the history
  • Loading branch information
TimeRainStarSky committed Jun 5, 2024
1 parent 72ea008 commit de4c47f
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions plugins/genshin/model/mys/mysInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,24 +259,22 @@ export default class MysInfo {
*/
static async initCache (force = false, clearData = false) {
// 检查缓存标记
let cache = DailyCache.create()
if (!force && await cache.get('cache-ready')) {
const cache = DailyCache.create()
if (!force && await cache.get('cache-ready') || this.initing)
return true
}
this.initing = true
await DailyCache.clearOutdatedData()

if (clearData) {
if (clearData)
await MysUser.clearCache()
}

// 先初始化用户CK,减少一些公共CK中ltuid无法识别的情况
await MysInfo.initUserCk()

await cache.set('cache-ready', new Date() * 1)

// 初始化公共ck
await MysInfo.initPubCk()

await cache.set('cache-ready', new Date() * 1)
delete this.initing
return true
}

Expand Down Expand Up @@ -462,4 +460,4 @@ export default class MysInfo {
/** 统计次数设为超限 */
await this.ckUser.disable(game)
}
}
}

0 comments on commit de4c47f

Please sign in to comment.