Stop live before removing files

pull/5975/head
Chocobozzz 2023-09-01 13:16:27 +02:00
parent d38a49463f
commit a1d9318066
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 14 additions and 14 deletions

View File

@ -796,6 +796,20 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {
InternalEventEmitter.Instance.emit('video-deleted', { video })
}
@BeforeDestroy
static stopLiveIfNeeded (instance: VideoModel) {
if (!instance.isLive) return
logger.info('Stopping live of video %s after video deletion.', instance.uuid)
LiveManager.Instance.stopSessionOf(instance.uuid, null)
}
@BeforeDestroy
static invalidateCache (instance: VideoModel) {
ModelCache.Instance.invalidateCache('video', instance.id)
}
@BeforeDestroy
static async sendDelete (instance: MVideoAccountLight, options: { transaction: Transaction }) {
if (!instance.isOwned()) return undefined
@ -848,20 +862,6 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {
return undefined
}
@BeforeDestroy
static stopLiveIfNeeded (instance: VideoModel) {
if (!instance.isLive) return
logger.info('Stopping live of video %s after video deletion.', instance.uuid)
LiveManager.Instance.stopSessionOf(instance.uuid, null)
}
@BeforeDestroy
static invalidateCache (instance: VideoModel) {
ModelCache.Instance.invalidateCache('video', instance.id)
}
@BeforeDestroy
static async saveEssentialDataToAbuses (instance: VideoModel, options) {
const tasks: Promise<any>[] = []