aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/video.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-09-25 10:04:21 +0200
committerChocobozzz <chocobozzz@cpy.re>2020-11-09 15:33:04 +0100
commita5cf76afa378aae81af2a9b0ce548e5d2582f832 (patch)
tree58da320232bee7c9656774c5d6811e82bbf6c696 /server/models/video/video.ts
parentde6310b2fcbb8a6b79c546b23dfa1920724faaa7 (diff)
downloadPeerTube-a5cf76afa378aae81af2a9b0ce548e5d2582f832.tar.gz
PeerTube-a5cf76afa378aae81af2a9b0ce548e5d2582f832.tar.zst
PeerTube-a5cf76afa378aae81af2a9b0ce548e5d2582f832.zip
Add watch messages if live has not started
Diffstat (limited to 'server/models/video/video.ts')
-rw-r--r--server/models/video/video.ts8
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'
127import { VideoStreamingPlaylistModel } from './video-streaming-playlist' 127import { VideoStreamingPlaylistModel } from './video-streaming-playlist'
128import { VideoTagModel } from './video-tag' 128import { VideoTagModel } from './video-tag'
129import { VideoViewModel } from './video-view' 129import { VideoViewModel } from './video-view'
130import { LiveManager } from '@server/lib/live-manager'
130 131
131export enum ScopeNames { 132export 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 }