Skip to content

Commit

Permalink
[fix] 重新确定清空缓存的时机
Browse files Browse the repository at this point in the history
  • Loading branch information
Eticeweng committed May 9, 2024
1 parent 70dccfe commit e8e5797
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,16 +158,16 @@ async function loadPreview(url, container) {
if (!turn.error) {
turn.result = extractContent(htmlParser(turn.result));
CUSTOM_LOG("baked:", turn.result);
if (cacheMap.size >= 100) {
cacheMap.clear();
}
} else {
CUSTOM_LOG("error:", turn.code);
}
try {
render(container, turn);
} catch (e) {
} finally {
if (cacheMap.size >= 100) {
cacheMap.clear();
}
cacheMap.set(id, turn);
}
CUSTOM_LOG("now cached", cacheMap.size);
Expand Down

0 comments on commit e8e5797

Please sign in to comment.