aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/schedulers/videos-redundancy-scheduler.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-11-15 10:07:44 +0100
committerChocobozzz <me@florianbigard.com>2018-11-15 10:15:34 +0100
commit742ddee1f131e6a2d701f2eeeb2851e8e1020cb2 (patch)
treee6ec6b7a9af76c3d20091436d8c648983bf63870 /server/lib/schedulers/videos-redundancy-scheduler.ts
parent2fbe7f1933f4bd5de96e6428234e56965616120e (diff)
downloadPeerTube-742ddee1f131e6a2d701f2eeeb2851e8e1020cb2.tar.gz
PeerTube-742ddee1f131e6a2d701f2eeeb2851e8e1020cb2.tar.zst
PeerTube-742ddee1f131e6a2d701f2eeeb2851e8e1020cb2.zip
Fix server redundancy tests
Diffstat (limited to 'server/lib/schedulers/videos-redundancy-scheduler.ts')
-rw-r--r--server/lib/schedulers/videos-redundancy-scheduler.ts5
1 files changed, 3 insertions, 2 deletions
diff --git a/server/lib/schedulers/videos-redundancy-scheduler.ts b/server/lib/schedulers/videos-redundancy-scheduler.ts
index c49a8c89a..8b7f33539 100644
--- a/server/lib/schedulers/videos-redundancy-scheduler.ts
+++ b/server/lib/schedulers/videos-redundancy-scheduler.ts
@@ -185,11 +185,12 @@ export class VideosRedundancyScheduler extends AbstractScheduler {
185 } 185 }
186 186
187 private async isTooHeavy (redundancy: VideosRedundancy, filesToDuplicate: VideoFileModel[]) { 187 private async isTooHeavy (redundancy: VideosRedundancy, filesToDuplicate: VideoFileModel[]) {
188 const maxSize = redundancy.size - this.getTotalFileSizes(filesToDuplicate) 188 const maxSize = redundancy.size
189 189
190 const totalDuplicated = await VideoRedundancyModel.getTotalDuplicated(redundancy.strategy) 190 const totalDuplicated = await VideoRedundancyModel.getTotalDuplicated(redundancy.strategy)
191 const totalWillDuplicate = totalDuplicated + this.getTotalFileSizes(filesToDuplicate)
191 192
192 return totalDuplicated > maxSize 193 return totalWillDuplicate > maxSize
193 } 194 }
194 195
195 private buildNewExpiration (expiresAfterMs: number) { 196 private buildNewExpiration (expiresAfterMs: number) {