From 59d85364826aa03d7ed65222d4624eb5dd3d72bf Mon Sep 17 00:00:00 2001 From: Cameron Pfiffer Date: Tue, 3 Feb 2026 14:58:51 -0800 Subject: [PATCH] Fix handler queue cleanup - remove processed items MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Queue was growing infinitely because processed items were never removed. Handler now cleans queue after processing by removing items that have draft files. Also manually cleaned 69 stale items from queue. 🤖 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta --- handlers/src/notification-handler.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/handlers/src/notification-handler.ts b/handlers/src/notification-handler.ts index 93ac6bd..3f9ad6d 100644 --- a/handlers/src/notification-handler.ts +++ b/handlers/src/notification-handler.ts @@ -191,6 +191,18 @@ Write each file and report what you did. } } + // Clean up queue: remove items that have been processed (have draft files) + const remainingQueue = queue.filter(item => { + const id = item.uri?.split("/").pop() || item.cid; + return !alreadyProcessed(id) && item.priority !== "SKIP"; + }); + + if (remainingQueue.length < queue.length) { + const removed = queue.length - remainingQueue.length; + fs.writeFileSync(queuePath, yaml.stringify(remainingQueue)); + console.log(`Cleaned queue: removed ${removed} processed items (${remainingQueue.length} remaining)`); + } + console.log(`\n[${new Date().toISOString()}] Handler complete.`); console.log("Next: npm run publish (or npm run publish:all for review items)"); } -- 2.54.0