diff --git a/lib/scan.js b/lib/scan.js index 377daab..a7ff9e2 100644 --- a/lib/scan.js +++ b/lib/scan.js @@ -80,7 +80,8 @@ async function startScanner() { //Remove stale files: those in historySet but not found in the current scan removeStaleFiles(discoveredFiles) logger.info({ component, message: `scan ended`, path: options.path }) - testScheduleNextScan() + // allow queue event handlers to fire before calling testScheduleNextScan() + setTimeout(testScheduleNextScan, 0) } catch (e) { logger.error({ component, error: serializeError(e) }) @@ -117,19 +118,6 @@ function scheduleNextScan() { }) } -/** - * Cancels the next scan and logs. - * References options properties {path}. - */ -function cancelNextScan() { - clearTimeout(timeoutId) - logger.info({ - component, - message: `scan cancelled`, - path: options.path - }) -} - /** * Returns immediately if options.historyFile is falsy. * Initializes the history Set by reading it from a file and adding each line to the history set.