Repository navigation
fix: 缓存判过期不再看 usable,档位落盘(0.2.40) - #5
Merged
Merged
Conversation
0.2.39 之后真机:手工收窄到 2 条,两分钟后缓存又变回 4 条。 isStale() 里还留着「每个模型必须有 usable 布尔」那条探测时代的判据 —— 探测已 默认关闭、新缓存不写 usable,于是每次 usage 都判定过期、每次后台重拉,把收窄 结果覆盖回四类混列。现在只看时间(TTL 6h)。 顺带把档位落盘:writeCatalog 写 tier、readCatalog 读回、configModels 读缓存时 再筛一遍(幂等)、refreshCatalog 没传 tier 时沿用旧值。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
0.2.39 之后真机:模型列表收窄到 2 条,两分钟后缓存又变回 4 条(未收窄)。
根因
isStale()里还留着「每个模型必须有usable布尔」那条判据 —— 那是探测时代的规则。探测已经默认关闭、新缓存根本不写usable,于是每一次 usage 都判定过期、每次都在后台重拉一遍,把收窄结果覆盖回「四类混列」。改法
isStale()只看时间(TTL 6 小时)writeCatalog(…, { tier })写tier,readCatalog读回来,configModels读缓存时按它再筛一遍(幂等),refreshCatalog没传 tier 时沿用旧值 —— 三道保险验证