X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmodels%2Fredundancy%2Fvideo-redundancy.ts;h=e8d79a3ab23dc218a5795751a22c76cdb72ee5eb;hb=842a15732b5ddcd9c9c90e790a448235800ef870;hp=f7a989691d83e201909bbb7fb887e8e275393135;hpb=8ee37c5f38b0f9b7e97239197d5590109c163250;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/models/redundancy/video-redundancy.ts b/server/models/redundancy/video-redundancy.ts index f7a989691..e8d79a3ab 100644 --- a/server/models/redundancy/video-redundancy.ts +++ b/server/models/redundancy/video-redundancy.ts @@ -1,5 +1,5 @@ import { sample } from 'lodash' -import { FindOptions, literal, Op, QueryTypes, Transaction, WhereOptions } from 'sequelize' +import { literal, Op, QueryTypes, Transaction, WhereOptions } from 'sequelize' import { AllowNull, BeforeDestroy, @@ -79,6 +79,9 @@ export enum ScopeNames { { fields: [ 'actorId' ] }, + { + fields: [ 'expiresOn' ] + }, { fields: [ 'url' ], unique: true @@ -157,8 +160,8 @@ export class VideoRedundancyModel extends Model logger.error('Cannot delete %s files.', logIdentifier, { err })) + videoFile.Video.removeWebTorrentFileAndTorrent(videoFile, true) + .catch(err => logger.error('Cannot delete %s files.', logIdentifier, { err })) } if (instance.videoStreamingPlaylistId) { @@ -408,7 +411,7 @@ export class VideoRedundancyModel extends Model { const actor = await getServerActor() const query = { @@ -467,16 +470,34 @@ export class VideoRedundancyModel extends Model