Poll dashboard duplicate cleanup between status updates
Run duplicate dashboard cleanup on a short interval so stale external Status messages are removed between normal status updates.
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user