diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/server/models/video/video.ts | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/server/server/models/video/video.ts b/server/server/models/video/video.ts index a6383b7c7..44d0605cc 100644 --- a/server/server/models/video/video.ts +++ b/server/server/models/video/video.ts | |||
@@ -797,6 +797,20 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> { | |||
797 | } | 797 | } |
798 | 798 | ||
799 | @BeforeDestroy | 799 | @BeforeDestroy |
800 | static stopLiveIfNeeded (instance: VideoModel) { | ||
801 | if (!instance.isLive) return | ||
802 | |||
803 | logger.info('Stopping live of video %s after video deletion.', instance.uuid) | ||
804 | |||
805 | LiveManager.Instance.stopSessionOf(instance.uuid, null) | ||
806 | } | ||
807 | |||
808 | @BeforeDestroy | ||
809 | static invalidateCache (instance: VideoModel) { | ||
810 | ModelCache.Instance.invalidateCache('video', instance.id) | ||
811 | } | ||
812 | |||
813 | @BeforeDestroy | ||
800 | static async sendDelete (instance: MVideoAccountLight, options: { transaction: Transaction }) { | 814 | static async sendDelete (instance: MVideoAccountLight, options: { transaction: Transaction }) { |
801 | if (!instance.isOwned()) return undefined | 815 | if (!instance.isOwned()) return undefined |
802 | 816 | ||
@@ -849,20 +863,6 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> { | |||
849 | } | 863 | } |
850 | 864 | ||
851 | @BeforeDestroy | 865 | @BeforeDestroy |
852 | static stopLiveIfNeeded (instance: VideoModel) { | ||
853 | if (!instance.isLive) return | ||
854 | |||
855 | logger.info('Stopping live of video %s after video deletion.', instance.uuid) | ||
856 | |||
857 | LiveManager.Instance.stopSessionOf(instance.uuid, null) | ||
858 | } | ||
859 | |||
860 | @BeforeDestroy | ||
861 | static invalidateCache (instance: VideoModel) { | ||
862 | ModelCache.Instance.invalidateCache('video', instance.id) | ||
863 | } | ||
864 | |||
865 | @BeforeDestroy | ||
866 | static async saveEssentialDataToAbuses (instance: VideoModel, options) { | 866 | static async saveEssentialDataToAbuses (instance: VideoModel, options) { |
867 | const tasks: Promise<any>[] = [] | 867 | const tasks: Promise<any>[] = [] |
868 | 868 | ||