X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmodels%2Fredundancy%2Fvideo-redundancy.ts;h=e8d79a3ab23dc218a5795751a22c76cdb72ee5eb;hb=842a15732b5ddcd9c9c90e790a448235800ef870;hp=ef780c2a4f1018fe72539f0ee56d24352e579e8b;hpb=20213fbd2a366dffc35aa7dddad71323893f8d62;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/models/redundancy/video-redundancy.ts b/server/models/redundancy/video-redundancy.ts index ef780c2a4..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,51 +411,7 @@ export class VideoRedundancyModel extends Model { - return parseAggregateResult(r1) + parseAggregateResult(r2) - }) - } - - static async listLocalExpired () { + static async listLocalExpired (): Promise { const actor = await getServerActor() const query = { @@ -511,16 +470,34 @@ export class VideoRedundancyModel extends Model