fix: use in-process Codex usage cache for unified service dashboard

This commit is contained in:
Eyejoker
2026-03-30 02:58:28 +09:00
parent debcbfccc2
commit 96ca9c0655

View File

@@ -480,14 +480,19 @@ async function buildUsageContent(): Promise<string> {
claudeBotRows.push(...buildClaudeUsageRows(cachedClaudeAccounts)); claudeBotRows.push(...buildClaudeUsageRows(cachedClaudeAccounts));
} }
// Group 2: Codex bot (separate service) // Group 2: Codex bot — use in-process cache (unified service)
// or fall back to snapshot from separate Codex service.
const codexBotRows: UsageRow[] = []; const codexBotRows: UsageRow[] = [];
const codexSnapshot = readStatusSnapshots(STATUS_SNAPSHOT_MAX_AGE_MS).find( if (cachedCodexUsageRows.length > 0) {
(s) => s.serviceId === 'codex-main' || s.serviceId === 'codex', codexBotRows.push(...cachedCodexUsageRows);
); } else {
codexBotRows.push( const codexSnapshot = readStatusSnapshots(STATUS_SNAPSHOT_MAX_AGE_MS).find(
...extractCodexUsageRows(codexSnapshot, USAGE_SNAPSHOT_MAX_AGE_MS), (s) => s.serviceId === 'codex-main' || s.serviceId === 'codex',
); );
codexBotRows.push(
...extractCodexUsageRows(codexSnapshot, USAGE_SNAPSHOT_MAX_AGE_MS),
);
}
lines.push(...renderUsageTable(claudeBotRows, codexBotRows)); lines.push(...renderUsageTable(claudeBotRows, codexBotRows));