aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/models/video/video.ts17
1 files changed, 6 insertions, 11 deletions
diff --git a/server/models/video/video.ts b/server/models/video/video.ts
index fabfce588..ca839b0d4 100644
--- a/server/models/video/video.ts
+++ b/server/models/video/video.ts
@@ -756,14 +756,14 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {
756 } 756 }
757 757
758 @BeforeDestroy 758 @BeforeDestroy
759 static async removeFiles (instance: VideoModel) { 759 static async removeFiles (instance: VideoModel, options) {
760 const tasks: Promise<any>[] = [] 760 const tasks: Promise<any>[] = []
761 761
762 logger.info('Removing files of video %s.', instance.url) 762 logger.info('Removing files of video %s.', instance.url)
763 763
764 if (instance.isOwned()) { 764 if (instance.isOwned()) {
765 if (!Array.isArray(instance.VideoFiles)) { 765 if (!Array.isArray(instance.VideoFiles)) {
766 instance.VideoFiles = await instance.$get('VideoFiles') 766 instance.VideoFiles = await instance.$get('VideoFiles', { transaction: options.transaction })
767 } 767 }
768 768
769 // Remove physical files and torrents 769 // Remove physical files and torrents
@@ -774,7 +774,7 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {
774 774
775 // Remove playlists file 775 // Remove playlists file
776 if (!Array.isArray(instance.VideoStreamingPlaylists)) { 776 if (!Array.isArray(instance.VideoStreamingPlaylists)) {
777 instance.VideoStreamingPlaylists = await instance.$get('VideoStreamingPlaylists') 777 instance.VideoStreamingPlaylists = await instance.$get('VideoStreamingPlaylists', { transaction: options.transaction })
778 } 778 }
779 779
780 for (const p of instance.VideoStreamingPlaylists) { 780 for (const p of instance.VideoStreamingPlaylists) {
@@ -797,7 +797,7 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {
797 797
798 logger.info('Stopping live of video %s after video deletion.', instance.uuid) 798 logger.info('Stopping live of video %s after video deletion.', instance.uuid)
799 799
800 return LiveManager.Instance.stopSessionOf(instance.id) 800 LiveManager.Instance.stopSessionOf(instance.id)
801 } 801 }
802 802
803 @BeforeDestroy 803 @BeforeDestroy
@@ -810,7 +810,7 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {
810 const tasks: Promise<any>[] = [] 810 const tasks: Promise<any>[] = []
811 811
812 if (!Array.isArray(instance.VideoAbuses)) { 812 if (!Array.isArray(instance.VideoAbuses)) {
813 instance.VideoAbuses = await instance.$get('VideoAbuses') 813 instance.VideoAbuses = await instance.$get('VideoAbuses', { transaction: options.transaction })
814 814
815 if (instance.VideoAbuses.length === 0) return undefined 815 if (instance.VideoAbuses.length === 0) return undefined
816 } 816 }
@@ -825,12 +825,7 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {
825 tasks.push(abuse.save({ transaction: options.transaction })) 825 tasks.push(abuse.save({ transaction: options.transaction }))
826 } 826 }
827 827
828 Promise.all(tasks) 828 await Promise.all(tasks)
829 .catch(err => {
830 logger.error('Some errors when saving details of video %s in its abuses before destroy hook.', instance.uuid, { err })
831 })
832
833 return undefined
834 } 829 }
835 830
836 static listLocal (): Promise<MVideo[]> { 831 static listLocal (): Promise<MVideo[]> {