Add:Server setting to disable folder watcher #378

This commit is contained in:
advplyr
2022-02-23 17:52:21 -06:00
parent 1a89b6e493
commit 7f1fc1901b
4 changed files with 47 additions and 58 deletions

View File

@@ -13,6 +13,8 @@ class FolderWatcher extends EventEmitter {
this.pendingFileUpdates = []
this.pendingDelay = 4000
this.pendingTimeout = null
this.disabled = false
}
get pendingFilePaths() {
@@ -71,10 +73,12 @@ class FolderWatcher extends EventEmitter {
}
addLibrary(library) {
if (this.disabled) return
this.buildLibraryWatcher(library)
}
updateLibrary(library) {
if (this.disabled) return
var libwatcher = this.libraryWatchers.find(lib => lib.id === library.id)
if (libwatcher) {
libwatcher.name = library.name
@@ -90,6 +94,7 @@ class FolderWatcher extends EventEmitter {
}
removeLibrary(library) {
if (this.disabled) return
var libwatcher = this.libraryWatchers.find(lib => lib.id === library.id)
if (libwatcher) {
Logger.info(`[Watcher] Removed watcher for "${library.name}"`)