From 2843a4e46ba86d6d5caacd9614df529394f4b5bd Mon Sep 17 00:00:00 2001 From: Pierre Date: Sat, 1 Nov 2025 23:12:52 +0100 Subject: [PATCH] queue improvement --- src/lib/folder-watcher/FolderWatcher.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/lib/folder-watcher/FolderWatcher.ts b/src/lib/folder-watcher/FolderWatcher.ts index 862daec..3f68a45 100644 --- a/src/lib/folder-watcher/FolderWatcher.ts +++ b/src/lib/folder-watcher/FolderWatcher.ts @@ -90,14 +90,15 @@ export class FolderWatcher { if (await this.fileProcessor.canProcessFile(filePath)) { const current = ++this.current; + // Mark as pending BEFORE adding to queue + // This ensures files appear in "pending" state while waiting for queue + if (this.fileProcessor.markPending) { + this.fileProcessor.markPending(filePath); + } + // Add to queue for concurrency control // The FileProcessor implementation handles its own internal queue logic await this.queue.add(async () => { - // Mark as pending (optional callback) - if (this.fileProcessor.markPending) { - this.fileProcessor.markPending(filePath); - } - // Light processing (quick metadata extraction) if (this.fileProcessor.queueFile) { await this.fileProcessor.queueFile(filePath);