diff --git a/background.js b/background.js
index b49e691..781b9df 100644
--- a/background.js
+++ b/background.js
@@ -388,6 +388,8 @@ async function clearCacheForMessages(idsInput) {
logger.aiLog("failed to clear cache for message", { level: 'error' }, e);
return { ok: false };
}
+ } else if (msg?.type === "sortana:getQueueCount") {
+ return { count: queuedCount + (processing ? 1 : 0) };
} else {
logger.aiLog("Unknown message type, ignoring", {level: 'warn'}, msg?.type);
}
diff --git a/options/options.html b/options/options.html
index f776fa2..6ddefa7 100644
--- a/options/options.html
+++ b/options/options.html
@@ -179,6 +179,7 @@
Rule count | |
Cache entries | |
+ Queue items | |
diff --git a/options/options.js b/options/options.js
index 5536ad5..7c1e595 100644
--- a/options/options.js
+++ b/options/options.js
@@ -304,8 +304,22 @@ document.addEventListener('DOMContentLoaded', async () => {
const ruleCountEl = document.getElementById('rule-count');
const cacheCountEl = document.getElementById('cache-count');
+ const queueCountEl = document.getElementById('queue-count');
ruleCountEl.textContent = (defaults.aiRules || []).length;
cacheCountEl.textContent = defaults.aiCache ? Object.keys(defaults.aiCache).length : 0;
+
+ async function refreshQueueCount() {
+ try {
+ const { count } = await browser.runtime.sendMessage({ type: 'sortana:getQueueCount' });
+ queueCountEl.textContent = count;
+ } catch (e) {
+ queueCountEl.textContent = '?';
+ }
+ }
+
+ refreshQueueCount();
+ setInterval(refreshQueueCount, 2000);
+
document.getElementById('clear-cache').addEventListener('click', async () => {
await AiClassifier.clearCache();
cacheCountEl.textContent = '0';