* Wait X seconds before notifying scanner that files changed * reset timer if files are still copying
()
| 324 | * reset timer if files are still copying |
| 325 | */ |
| 326 | handlePendingFileUpdatesTimeout() { |
| 327 | clearTimeout(this.pendingTimeout) |
| 328 | this.pendingTimeout = setTimeout(() => { |
| 329 | // Check that files are not still being added |
| 330 | if (this.pendingFileUpdates.some((pfu) => this.filesBeingAdded.has(pfu.path))) { |
| 331 | Logger.debug(`[Watcher] Still waiting for pending files "${[...this.filesBeingAdded].join(', ')}"`) |
| 332 | return this.handlePendingFileUpdatesTimeout() |
| 333 | } |
| 334 | |
| 335 | if (this.pendingFileUpdates.length) { |
| 336 | this.emit('scanFilesChanged', this.pendingFileUpdates, this.pendingTask) |
| 337 | } else { |
| 338 | const taskFinishedString = { |
| 339 | text: 'No files to scan', |
| 340 | key: 'MessageTaskNoFilesToScan' |
| 341 | } |
| 342 | this.pendingTask.setFinished(taskFinishedString) |
| 343 | TaskManager.taskFinished(this.pendingTask) |
| 344 | } |
| 345 | this.pendingTask = null |
| 346 | this.pendingFileUpdates = [] |
| 347 | this.filesBeingAdded.clear() |
| 348 | }, this.pendingDelay) |
| 349 | } |
| 350 | |
| 351 | /** |
| 352 | * |
no test coverage detected