queue improvement

This commit is contained in:
Pierre
2025-11-01 23:12:52 +01:00
parent c6983be96b
commit 2843a4e46b
+5 -4
View File
@@ -90,14 +90,15 @@ export class FolderWatcher {
if (await this.fileProcessor.canProcessFile(filePath)) { if (await this.fileProcessor.canProcessFile(filePath)) {
const current = ++this.current; const current = ++this.current;
// Add to queue for concurrency control // Mark as pending BEFORE adding to queue
// The FileProcessor implementation handles its own internal queue logic // This ensures files appear in "pending" state while waiting for queue
await this.queue.add(async () => {
// Mark as pending (optional callback)
if (this.fileProcessor.markPending) { if (this.fileProcessor.markPending) {
this.fileProcessor.markPending(filePath); this.fileProcessor.markPending(filePath);
} }
// Add to queue for concurrency control
// The FileProcessor implementation handles its own internal queue logic
await this.queue.add(async () => {
// Light processing (quick metadata extraction) // Light processing (quick metadata extraction)
if (this.fileProcessor.queueFile) { if (this.fileProcessor.queueFile) {
await this.fileProcessor.queueFile(filePath); await this.fileProcessor.queueFile(filePath);