]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/lib/redundancy.ts
16b1226585d76f277a65be40001c3f29ef497fed
[github/Chocobozzz/PeerTube.git] / server / lib / redundancy.ts
1 import { VideoRedundancyModel } from '../models/redundancy/video-redundancy'
2 import { sendUndoCacheFile } from './activitypub/send'
3 import { Transaction } from 'sequelize'
4 import { getServerActor } from '../helpers/utils'
5
6 async function removeVideoRedundancy (videoRedundancy: VideoRedundancyModel, t?: Transaction) {
7 const serverActor = await getServerActor()
8
9 // Local cache, send undo to remote instances
10 if (videoRedundancy.actorId === serverActor.id) await sendUndoCacheFile(serverActor, videoRedundancy, t)
11
12 await videoRedundancy.destroy({ transaction: t })
13 }
14
15 // ---------------------------------------------------------------------------
16
17 export {
18 removeVideoRedundancy
19 }