mirror of
				https://github.com/advplyr/audiobookshelf.git
				synced 2025-10-27 11:18:14 +01:00 
			
		
		
		
	Merge pull request #3604 from mikiher/episode-download-oom
Remove unnecessary episode_download_queue_updated socket event causing OOM
This commit is contained in:
		
						commit
						48e0a3c450
					
				@ -638,6 +638,11 @@ export default {
 | 
				
			|||||||
        this.episodesDownloading = this.episodesDownloading.filter((d) => d.id !== episodeDownload.id)
 | 
					        this.episodesDownloading = this.episodesDownloading.filter((d) => d.id !== episodeDownload.id)
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					    episodeDownloadQueueCleared(libraryItemId) {
 | 
				
			||||||
 | 
					      if (libraryItemId === this.libraryItemId) {
 | 
				
			||||||
 | 
					        this.episodeDownloadsQueued = []
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
    rssFeedOpen(data) {
 | 
					    rssFeedOpen(data) {
 | 
				
			||||||
      if (data.entityId === this.libraryItemId) {
 | 
					      if (data.entityId === this.libraryItemId) {
 | 
				
			||||||
        console.log('RSS Feed Opened', data)
 | 
					        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_queued', this.episodeDownloadQueued)
 | 
				
			||||||
    this.$root.socket.on('episode_download_started', this.episodeDownloadStarted)
 | 
					    this.$root.socket.on('episode_download_started', this.episodeDownloadStarted)
 | 
				
			||||||
    this.$root.socket.on('episode_download_finished', this.episodeDownloadFinished)
 | 
					    this.$root.socket.on('episode_download_finished', this.episodeDownloadFinished)
 | 
				
			||||||
 | 
					    this.$root.socket.on('episode_download_queue_cleared', this.episodeDownloadQueueCleared)
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  beforeDestroy() {
 | 
					  beforeDestroy() {
 | 
				
			||||||
    this.$eventBus.$off(`${this.libraryItem.id}_updated`, this.libraryItemUpdated)
 | 
					    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_queued', this.episodeDownloadQueued)
 | 
				
			||||||
    this.$root.socket.off('episode_download_started', this.episodeDownloadStarted)
 | 
					    this.$root.socket.off('episode_download_started', this.episodeDownloadStarted)
 | 
				
			||||||
    this.$root.socket.off('episode_download_finished', this.episodeDownloadFinished)
 | 
					    this.$root.socket.off('episode_download_finished', this.episodeDownloadFinished)
 | 
				
			||||||
 | 
					    this.$root.socket.off('episode_download_queue_cleared', this.episodeDownloadQueueCleared)
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
 | 
				
			|||||||
@ -104,9 +104,6 @@ export default {
 | 
				
			|||||||
        this.episodesDownloading = this.episodesDownloading.filter((d) => d.id !== episodeDownload.id)
 | 
					        this.episodesDownloading = this.episodesDownloading.filter((d) => d.id !== episodeDownload.id)
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    episodeDownloadQueueUpdated(downloadQueueDetails) {
 | 
					 | 
				
			||||||
      this.episodeDownloadsQueued = downloadQueueDetails.queue.filter((q) => q.libraryId == this.libraryId)
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    async loadInitialDownloadQueue() {
 | 
					    async loadInitialDownloadQueue() {
 | 
				
			||||||
      this.processing = true
 | 
					      this.processing = true
 | 
				
			||||||
      const queuePayload = await this.$axios.$get(`/api/libraries/${this.libraryId}/episode-downloads`).catch((error) => {
 | 
					      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_queued', this.episodeDownloadQueued)
 | 
				
			||||||
      this.$root.socket.on('episode_download_started', this.episodeDownloadStarted)
 | 
					      this.$root.socket.on('episode_download_started', this.episodeDownloadStarted)
 | 
				
			||||||
      this.$root.socket.on('episode_download_finished', this.episodeDownloadFinished)
 | 
					      this.$root.socket.on('episode_download_finished', this.episodeDownloadFinished)
 | 
				
			||||||
      this.$root.socket.on('episode_download_queue_updated', this.episodeDownloadQueueUpdated)
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  mounted() {
 | 
					  mounted() {
 | 
				
			||||||
@ -138,7 +134,6 @@ export default {
 | 
				
			|||||||
    this.$root.socket.off('episode_download_queued', this.episodeDownloadQueued)
 | 
					    this.$root.socket.off('episode_download_queued', this.episodeDownloadQueued)
 | 
				
			||||||
    this.$root.socket.off('episode_download_started', this.episodeDownloadStarted)
 | 
					    this.$root.socket.off('episode_download_started', this.episodeDownloadStarted)
 | 
				
			||||||
    this.$root.socket.off('episode_download_finished', this.episodeDownloadFinished)
 | 
					    this.$root.socket.off('episode_download_finished', this.episodeDownloadFinished)
 | 
				
			||||||
    this.$root.socket.off('episode_download_queue_updated', this.episodeDownloadQueueUpdated)
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
 | 
				
			|||||||
@ -46,6 +46,7 @@ class PodcastManager {
 | 
				
			|||||||
      var itemDownloads = this.getEpisodeDownloadsInQueue(libraryItemId)
 | 
					      var itemDownloads = this.getEpisodeDownloadsInQueue(libraryItemId)
 | 
				
			||||||
      Logger.info(`[PodcastManager] Clearing downloads in queue for item "${libraryItemId}" (${itemDownloads.length})`)
 | 
					      Logger.info(`[PodcastManager] Clearing downloads in queue for item "${libraryItemId}" (${itemDownloads.length})`)
 | 
				
			||||||
      this.downloadQueue = this.downloadQueue.filter((d) => d.libraryItemId !== libraryItemId)
 | 
					      this.downloadQueue = this.downloadQueue.filter((d) => d.libraryItemId !== libraryItemId)
 | 
				
			||||||
 | 
					      SocketAuthority.emitter('episode_download_queue_cleared', libraryItemId)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -63,7 +64,6 @@ class PodcastManager {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  async startPodcastEpisodeDownload(podcastEpisodeDownload) {
 | 
					  async startPodcastEpisodeDownload(podcastEpisodeDownload) {
 | 
				
			||||||
    SocketAuthority.emitter('episode_download_queue_updated', this.getDownloadQueueDetails())
 | 
					 | 
				
			||||||
    if (this.currentDownload) {
 | 
					    if (this.currentDownload) {
 | 
				
			||||||
      this.downloadQueue.push(podcastEpisodeDownload)
 | 
					      this.downloadQueue.push(podcastEpisodeDownload)
 | 
				
			||||||
      SocketAuthority.emitter('episode_download_queued', podcastEpisodeDownload.toJSONForClient())
 | 
					      SocketAuthority.emitter('episode_download_queued', podcastEpisodeDownload.toJSONForClient())
 | 
				
			||||||
@ -149,7 +149,6 @@ class PodcastManager {
 | 
				
			|||||||
    TaskManager.taskFinished(task)
 | 
					    TaskManager.taskFinished(task)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    SocketAuthority.emitter('episode_download_finished', this.currentDownload.toJSONForClient())
 | 
					    SocketAuthority.emitter('episode_download_finished', this.currentDownload.toJSONForClient())
 | 
				
			||||||
    SocketAuthority.emitter('episode_download_queue_updated', this.getDownloadQueueDetails())
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Watcher.removeIgnoreDir(this.currentDownload.libraryItem.path)
 | 
					    Watcher.removeIgnoreDir(this.currentDownload.libraryItem.path)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user