diff --git a/client/components/tables/podcast/EpisodesTable.vue b/client/components/tables/podcast/EpisodesTable.vue index 8b29198c..9534b34e 100644 --- a/client/components/tables/podcast/EpisodesTable.vue +++ b/client/components/tables/podcast/EpisodesTable.vue @@ -191,7 +191,7 @@ export default { } }, methods: { - search() {}, + submit() {}, inputUpdate() { clearTimeout(this.searchTimeout) this.searchTimeout = setTimeout(() => { diff --git a/server/Logger.js b/server/Logger.js index b49220df..19e657b4 100644 --- a/server/Logger.js +++ b/server/Logger.js @@ -92,7 +92,7 @@ class Logger { * @param {...any} args */ dev(...args) { - if (!this.isDev) return + if (!this.isDev || process.env.HIDE_DEV_LOGS === '1') return console.log(`[${this.timestamp}] DEV:`, ...args) } diff --git a/server/Watcher.js b/server/Watcher.js index bc6b6094..577460a4 100644 --- a/server/Watcher.js +++ b/server/Watcher.js @@ -28,6 +28,8 @@ class FolderWatcher extends EventEmitter { this.ignoreDirs = [] /** @type {string[]} */ this.pendingDirsToRemoveFromIgnore = [] + /** @type {NodeJS.Timeout} */ + this.removeFromIgnoreTimer = null this.disabled = false } @@ -240,9 +242,12 @@ class FolderWatcher extends EventEmitter { */ addIgnoreDir(path) { path = this.cleanDirPath(path) - if (this.ignoreDirs.includes(path)) return this.pendingDirsToRemoveFromIgnore = this.pendingDirsToRemoveFromIgnore.filter(p => p !== path) - Logger.debug(`[Watcher] Ignoring directory "${path}"`) + if (this.ignoreDirs.includes(path)) { + // Already ignoring dir + return + } + Logger.debug(`[Watcher] addIgnoreDir: Ignoring directory "${path}"`) this.ignoreDirs.push(path) } @@ -255,18 +260,24 @@ class FolderWatcher extends EventEmitter { */ removeIgnoreDir(path) { path = this.cleanDirPath(path) - if (!this.ignoreDirs.includes(path) || this.pendingDirsToRemoveFromIgnore.includes(path)) return + if (!this.ignoreDirs.includes(path)) { + Logger.debug(`[Watcher] removeIgnoreDir: Path is not being ignored "${path}"`) + return + } // Add a 5 second delay before removing the ignore from this dir - this.pendingDirsToRemoveFromIgnore.push(path) - setTimeout(() => { + if (!this.pendingDirsToRemoveFromIgnore.includes(path)) { + this.pendingDirsToRemoveFromIgnore.push(path) + } + + clearTimeout(this.removeFromIgnoreTimer) + this.removeFromIgnoreTimer = setTimeout(() => { if (this.pendingDirsToRemoveFromIgnore.includes(path)) { this.pendingDirsToRemoveFromIgnore = this.pendingDirsToRemoveFromIgnore.filter(p => p !== path) - Logger.debug(`[Watcher] No longer ignoring directory "${path}"`) + Logger.debug(`[Watcher] removeIgnoreDir: No longer ignoring directory "${path}"`) this.ignoreDirs = this.ignoreDirs.filter(p => p !== path) } }, 5000) - } } module.exports = FolderWatcher \ No newline at end of file