diff options
Diffstat (limited to 'server/models/video/video.ts')
-rw-r--r-- | server/models/video/video.ts | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/server/models/video/video.ts b/server/models/video/video.ts index a3e3b6cfe..8493ab802 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts | |||
@@ -127,6 +127,7 @@ import { VideoShareModel } from './video-share' | |||
127 | import { VideoStreamingPlaylistModel } from './video-streaming-playlist' | 127 | import { VideoStreamingPlaylistModel } from './video-streaming-playlist' |
128 | import { VideoTagModel } from './video-tag' | 128 | import { VideoTagModel } from './video-tag' |
129 | import { VideoViewModel } from './video-view' | 129 | import { VideoViewModel } from './video-view' |
130 | import { LiveManager } from '@server/lib/live-manager' | ||
130 | 131 | ||
131 | export enum ScopeNames { | 132 | export enum ScopeNames { |
132 | AVAILABLE_FOR_LIST_IDS = 'AVAILABLE_FOR_LIST_IDS', | 133 | AVAILABLE_FOR_LIST_IDS = 'AVAILABLE_FOR_LIST_IDS', |
@@ -800,6 +801,13 @@ export class VideoModel extends Model<VideoModel> { | |||
800 | } | 801 | } |
801 | 802 | ||
802 | @BeforeDestroy | 803 | @BeforeDestroy |
804 | static stopLiveIfNeeded (instance: VideoModel) { | ||
805 | if (!instance.isLive) return | ||
806 | |||
807 | return LiveManager.Instance.stopSessionOf(instance.id) | ||
808 | } | ||
809 | |||
810 | @BeforeDestroy | ||
803 | static invalidateCache (instance: VideoModel) { | 811 | static invalidateCache (instance: VideoModel) { |
804 | ModelCache.Instance.invalidateCache('video', instance.id) | 812 | ModelCache.Instance.invalidateCache('video', instance.id) |
805 | } | 813 | } |