From b50d7f09278c74eeccffdff1ecc0f2eb4cb8f04f Mon Sep 17 00:00:00 2001 From: mikiher Date: Tue, 12 Nov 2024 07:25:10 +0200 Subject: [PATCH 1/2] Remove unnecessary socket event causing OOM --- client/pages/library/_library/podcast/download-queue.vue | 5 ----- server/managers/PodcastManager.js | 2 -- 2 files changed, 7 deletions(-) diff --git a/client/pages/library/_library/podcast/download-queue.vue b/client/pages/library/_library/podcast/download-queue.vue index 777ddfc1..5f4bab62 100644 --- a/client/pages/library/_library/podcast/download-queue.vue +++ b/client/pages/library/_library/podcast/download-queue.vue @@ -104,9 +104,6 @@ export default { this.episodesDownloading = this.episodesDownloading.filter((d) => d.id !== episodeDownload.id) } }, - episodeDownloadQueueUpdated(downloadQueueDetails) { - this.episodeDownloadsQueued = downloadQueueDetails.queue.filter((q) => q.libraryId == this.libraryId) - }, async loadInitialDownloadQueue() { this.processing = true const queuePayload = await this.$axios.$get(`/api/libraries/${this.libraryId}/episode-downloads`).catch((error) => { @@ -128,7 +125,6 @@ export default { this.$root.socket.on('episode_download_queued', this.episodeDownloadQueued) this.$root.socket.on('episode_download_started', this.episodeDownloadStarted) this.$root.socket.on('episode_download_finished', this.episodeDownloadFinished) - this.$root.socket.on('episode_download_queue_updated', this.episodeDownloadQueueUpdated) } }, mounted() { @@ -138,7 +134,6 @@ export default { this.$root.socket.off('episode_download_queued', this.episodeDownloadQueued) this.$root.socket.off('episode_download_started', this.episodeDownloadStarted) this.$root.socket.off('episode_download_finished', this.episodeDownloadFinished) - this.$root.socket.off('episode_download_queue_updated', this.episodeDownloadQueueUpdated) } } diff --git a/server/managers/PodcastManager.js b/server/managers/PodcastManager.js index 96ffcb6a..01e661d9 100644 --- a/server/managers/PodcastManager.js +++ b/server/managers/PodcastManager.js @@ -63,7 +63,6 @@ class PodcastManager { } async startPodcastEpisodeDownload(podcastEpisodeDownload) { - SocketAuthority.emitter('episode_download_queue_updated', this.getDownloadQueueDetails()) if (this.currentDownload) { this.downloadQueue.push(podcastEpisodeDownload) SocketAuthority.emitter('episode_download_queued', podcastEpisodeDownload.toJSONForClient()) @@ -149,7 +148,6 @@ class PodcastManager { TaskManager.taskFinished(task) SocketAuthority.emitter('episode_download_finished', this.currentDownload.toJSONForClient()) - SocketAuthority.emitter('episode_download_queue_updated', this.getDownloadQueueDetails()) Watcher.removeIgnoreDir(this.currentDownload.libraryItem.path) From 8626fa3e00871555a80a647e058cd8f62ba2ea59 Mon Sep 17 00:00:00 2001 From: mikiher Date: Tue, 12 Nov 2024 07:37:38 +0200 Subject: [PATCH 2/2] Add episode_download_queue_cleared socket event --- client/pages/item/_id/index.vue | 7 +++++++ server/managers/PodcastManager.js | 1 + 2 files changed, 8 insertions(+) diff --git a/client/pages/item/_id/index.vue b/client/pages/item/_id/index.vue index 57a1ae74..1baf521c 100644 --- a/client/pages/item/_id/index.vue +++ b/client/pages/item/_id/index.vue @@ -638,6 +638,11 @@ export default { this.episodesDownloading = this.episodesDownloading.filter((d) => d.id !== episodeDownload.id) } }, + episodeDownloadQueueCleared(libraryItemId) { + if (libraryItemId === this.libraryItemId) { + this.episodeDownloadsQueued = [] + } + }, rssFeedOpen(data) { if (data.entityId === this.libraryItemId) { console.log('RSS Feed Opened', data) @@ -776,6 +781,7 @@ export default { this.$root.socket.on('episode_download_queued', this.episodeDownloadQueued) this.$root.socket.on('episode_download_started', this.episodeDownloadStarted) this.$root.socket.on('episode_download_finished', this.episodeDownloadFinished) + this.$root.socket.on('episode_download_queue_cleared', this.episodeDownloadQueueCleared) }, beforeDestroy() { this.$eventBus.$off(`${this.libraryItem.id}_updated`, this.libraryItemUpdated) @@ -787,6 +793,7 @@ export default { this.$root.socket.off('episode_download_queued', this.episodeDownloadQueued) this.$root.socket.off('episode_download_started', this.episodeDownloadStarted) this.$root.socket.off('episode_download_finished', this.episodeDownloadFinished) + this.$root.socket.off('episode_download_queue_cleared', this.episodeDownloadQueueCleared) } } diff --git a/server/managers/PodcastManager.js b/server/managers/PodcastManager.js index 01e661d9..0a32e3ca 100644 --- a/server/managers/PodcastManager.js +++ b/server/managers/PodcastManager.js @@ -46,6 +46,7 @@ class PodcastManager { var itemDownloads = this.getEpisodeDownloadsInQueue(libraryItemId) Logger.info(`[PodcastManager] Clearing downloads in queue for item "${libraryItemId}" (${itemDownloads.length})`) this.downloadQueue = this.downloadQueue.filter((d) => d.libraryItemId !== libraryItemId) + SocketAuthority.emitter('episode_download_queue_cleared', libraryItemId) } }