refactor(gateway): reuse session message count helper · openclaw/openclaw@ae6bea1
vincentkoc
·
2026-06-22
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -643,22 +643,7 @@ export async function readSessionMessageCountAsync(
|
643 | 643 | if (!filePath) { |
644 | 644 | return 0; |
645 | 645 | } |
646 | | -let stat: fs.Stats | null = null; |
647 | | -try { |
648 | | -stat = await fs.promises.stat(filePath); |
649 | | -const cached = getCachedTranscriptMessageCount(filePath, stat); |
650 | | -if (typeof cached === "number") { |
651 | | -return cached; |
652 | | -} |
653 | | -} catch { |
654 | | -// Count from the transcript reader below when stat metadata is unavailable. |
655 | | -} |
656 | | -const index = await readSessionTranscriptIndex(filePath); |
657 | | -const count = index?.entries.length ?? 0; |
658 | | -if (stat) { |
659 | | -setCachedTranscriptMessageCount(filePath, stat, count); |
660 | | -} |
661 | | -return count; |
| 646 | +return await readSessionMessageCountFromPathAsync(filePath); |
662 | 647 | } |
663 | 648 | |
664 | 649 | export function readRecentSessionMessagesWithStats( |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。