From 5996a87058363f01cf2deeb53361b7915d3ab94c Mon Sep 17 00:00:00 2001 From: wagesj45 Date: Fri, 30 Jan 2026 15:08:33 -0600 Subject: [PATCH] Add timing stats reset button --- background.js | 9 +++++++++ manifest.json | 2 +- options/options.html | 14 ++++++++++---- options/options.js | 5 +++++ 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/background.js b/background.js index 827dec8..b2efc89 100644 --- a/background.js +++ b/background.js @@ -750,6 +750,15 @@ async function clearCacheForMessages(idsInput) { logger.aiLog("failed to clear cache for message", { level: 'error' }, e); return { ok: false }; } + } else if (msg?.type === "sortana:resetTimingStats") { + const last = timingStats.last; + timingStats.count = 0; + timingStats.mean = 0; + timingStats.m2 = 0; + timingStats.total = 0; + timingStats.last = typeof last === 'number' ? last : -1; + await storage.local.set({ classifyStats: timingStats }); + return { ok: true }; } else if (msg?.type === "sortana:getQueueCount") { return { count: queuedCount + (processing ? 1 : 0) }; } else if (msg?.type === "sortana:getErrorLog") { diff --git a/manifest.json b/manifest.json index 81baae5..dcddb67 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "name": "Sortana", - "version": "2.4.1", + "version": "2.4.2", "default_locale": "en-US", "applications": { "gecko": { diff --git a/options/options.html b/options/options.html index 2a1431e..cfc370d 100644 --- a/options/options.html +++ b/options/options.html @@ -298,10 +298,16 @@ Messages per day0 - +
+ + +
diff --git a/options/options.js b/options/options.js index 872a7c9..9a61542 100644 --- a/options/options.js +++ b/options/options.js @@ -1017,6 +1017,11 @@ document.addEventListener('DOMContentLoaded', async () => { cacheCountEl.textContent = '0'; }); + document.getElementById('reset-timing').addEventListener('click', async () => { + await browser.runtime.sendMessage({ type: 'sortana:resetTimingStats' }); + await refreshMaintenance(); + }); + function selectedCategories() { return [...document.querySelectorAll('.transfer-category:checked')].map(el => el.value); }