diff --git a/server/lib/schedulers/videos-redundancy-scheduler.ts b/server/lib/schedulers/videos-redundancy-scheduler.ts index 9e2667416..59b55cccc 100644 --- a/server/lib/schedulers/videos-redundancy-scheduler.ts +++ b/server/lib/schedulers/videos-redundancy-scheduler.ts @@ -317,8 +317,8 @@ export class VideosRedundancyScheduler extends AbstractScheduler { private async isTooHeavy (candidateToDuplicate: CandidateToDuplicate) { const maxSize = candidateToDuplicate.redundancy.size - const totalDuplicated = await VideoRedundancyModel.getTotalDuplicated(candidateToDuplicate.redundancy.strategy) - const totalWillDuplicate = totalDuplicated + this.getTotalFileSizes(candidateToDuplicate.files, candidateToDuplicate.streamingPlaylists) + const { totalUsed } = await VideoRedundancyModel.getStats(candidateToDuplicate.redundancy.strategy) + const totalWillDuplicate = totalUsed + this.getTotalFileSizes(candidateToDuplicate.files, candidateToDuplicate.streamingPlaylists) return totalWillDuplicate > maxSize } diff --git a/server/models/redundancy/video-redundancy.ts b/server/models/redundancy/video-redundancy.ts index ef780c2a4..f7a989691 100644 --- a/server/models/redundancy/video-redundancy.ts +++ b/server/models/redundancy/video-redundancy.ts @@ -408,50 +408,6 @@ export class VideoRedundancyModel extends Model { - return parseAggregateResult(r1) + parseAggregateResult(r2) - }) - } - static async listLocalExpired () { const actor = await getServerActor() diff --git a/server/models/video/video.ts b/server/models/video/video.ts index 749ef7197..d4a258187 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts @@ -1009,6 +1009,7 @@ export class VideoModel extends Model>> { attributes: [ 'id' ], where: { isLive: true, + remote: false, state: VideoState.PUBLISHED } }