diff options
author | Chocobozzz <me@florianbigard.com> | 2020-09-25 10:04:21 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-11-09 15:33:04 +0100 |
commit | a5cf76afa378aae81af2a9b0ce548e5d2582f832 (patch) | |
tree | 58da320232bee7c9656774c5d6811e82bbf6c696 /server/models/video/video.ts | |
parent | de6310b2fcbb8a6b79c546b23dfa1920724faaa7 (diff) | |
download | PeerTube-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.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 | } |