fix: poll dashboard duplicate cleanup between status updates

This commit is contained in:
ejclaw
2026-05-04 00:00:10 +09:00
parent 8d7a62a9aa
commit f3d46ca017
2 changed files with 19 additions and 0 deletions

View File

@@ -99,6 +99,7 @@ const USAGE_SNAPSHOT_MAX_AGE_MS = 600_000;
* so this only affects how quickly Codex snapshot data is picked up.
*/
const RENDERER_USAGE_REFRESH_MS = 30_000;
const DASHBOARD_DUPLICATE_CLEANUP_POLL_MS = 2_000;
let statusMessageId: string | null = null;
let cachedUsageContent = '';
@@ -171,6 +172,12 @@ export function shouldPurgeDashboardChannelOnStart(args: {
return args.purgeOnStart === true;
}
export function getDashboardDuplicateCleanupIntervalMs(
statusUpdateInterval: number,
): number {
return Math.min(statusUpdateInterval, DASHBOARD_DUPLICATE_CLEANUP_POLL_MS);
}
async function refreshChannelMeta(
opts: UnifiedDashboardOptions,
): Promise<void> {
@@ -798,6 +805,10 @@ export async function startUnifiedDashboard(
};
setInterval(updateStatus, opts.statusUpdateInterval);
setInterval(() => {
if (!isRenderer || !statusMessageId) return;
void cleanupDashboardDuplicateMessages(opts, statusMessageId);
}, getDashboardDuplicateCleanupIntervalMs(opts.statusUpdateInterval));
await updateStatus();
if (isRenderer) {