use push event helper instead of directly added event to queue

This commit is contained in:
Abhinav 2022-09-09 09:23:01 +05:30
parent 3609067243
commit 45eabbf0c2

View file

@ -94,8 +94,6 @@ class watchFolderService {
this.uploadDiffOfFiles(mapping, filesOnDisk); this.uploadDiffOfFiles(mapping, filesOnDisk);
this.trashDiffOfFiles(mapping, filesOnDisk); this.trashDiffOfFiles(mapping, filesOnDisk);
} }
await this.runNextEvent();
} catch (e) { } catch (e) {
logError(e, 'error while getting and syncing diff of files'); logError(e, 'error while getting and syncing diff of files');
} }
@ -128,7 +126,7 @@ class watchFolderService {
folderPath: mapping.folderPath, folderPath: mapping.folderPath,
files: [file], files: [file],
}; };
this.eventQueue.push(event); this.pushEvent(event);
} }
} }
} }
@ -154,7 +152,7 @@ class watchFolderService {
folderPath: mapping.folderPath, folderPath: mapping.folderPath,
paths: [file.path], paths: [file.path],
}; };
this.eventQueue.push(event); this.pushEvent(event);
} }
} }
} }
@ -176,7 +174,7 @@ class watchFolderService {
return notDeletedMappings; return notDeletedMappings;
} }
async pushEvent(event: EventQueueItem) { pushEvent(event: EventQueueItem) {
this.eventQueue.push(event); this.eventQueue.push(event);
debounce(this.runNextEvent.bind(this), 300)(); debounce(this.runNextEvent.bind(this), 300)();
} }