X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmodels%2Fredundancy%2Fvideo-redundancy.ts;h=52997792420b6062e96c93803f6078bfe2a874d5;hb=d7ce63d3dd63e51096f76371403ac4859d69bef5;hp=ef780c2a4f1018fe72539f0ee56d24352e579e8b;hpb=1e4d2cb5aef11898585fae4053da4ebd0a69b480;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/models/redundancy/video-redundancy.ts b/server/models/redundancy/video-redundancy.ts index ef780c2a4..529977924 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.removeFileAndTorrent(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