Do no delete if darabase update fails

This commit is contained in:
mikiher committed 2026-12-04 07:45:21 +02:00
1 parent 177b945c60
commit dc0afcce79
2 files changed
+8 -6

No files matched your search

+4 -4
View File
@@ -799,15 +799,15 @@ class PodcastController {
removedEpisodes.push(episode)
}
if (hardDelete) {
await removeEpisodeAudioFiles(removedEpisodes)
}
const removedEpisodeIds = removedEpisodes.map((ep) => ep.id)
await Database.playlistModel.removeMediaItemsFromPlaylists(removedEpisodeIds)
await deleteEpisodesInTransaction(removedEpisodeIds, matchedByLibraryItem)
libraryItemsPodcastFilters.clearCountCache('podcastEpisode', 'afterDestroy')
if (hardDelete) {
await removeEpisodeAudioFiles(removedEpisodes)
}
for (const [libraryItem, episodesToRemove] of matchedByLibraryItem) {
Logger.info(`[PodcastController] Batch deleted ${episodesToRemove.length} episode(s) from podcast "${libraryItem.media.title}"`)
SocketAuthority.libraryItemEmitter('item_updated', libraryItem)