-
Notifications
You must be signed in to change notification settings - Fork 2.7k
fix: use lru-cache lib to improve alive minApp #8187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
这个库820kb |
先把原来出错的pr revert掉,这个再慢慢看 |
这个库应该是我之前重构代码块的时候就引入了😂 |
那还好。这个测试就交给你看看了 |
#4167 当时做代码块缓存的时候引入了,后来虽然移除了这个缓存,重构shiki高亮的时候又用上了😂 |
收到 |
这个1.5.0就先不上了,不着急,弄好先 |
@alephpiece @GeorgeDong32 麻烦两位再看看 |
这还有个 warning 刚才又遇到一次崩溃,不过现在我没法复现了😂 |
if (minAppsCache.size <= maxKeepAliveMinapps) { | ||
const oldEntries = Array.from(minAppsCache.entries()) | ||
minAppsCache = createLRUCache() | ||
oldEntries.forEach(([key, value]) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里好像会导致LRU cache翻转,活跃的小程序反而会被最先出缓存
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
脑子转不过来hhhh。看来要从后往前set
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
感觉是不是可以把 miniapp cache 的逻辑拆出来,作为一个小 service,utils 什么的,然后加些测试
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我觉的先把这个做完 然后把 整个 lru-cache
的包去掉,自己定义 LRU 的逻辑
Related: #8160 (comment)
@alephpiece 现在这样是不是就可以了(不好意思又 ping 你了 😂
Electron.mp4