diff options
author | buoyantair <buoyantair@protonmail.com> | 2018-11-16 02:37:16 +0530 |
---|---|---|
committer | buoyantair <buoyantair@protonmail.com> | 2018-11-16 02:37:16 +0530 |
commit | ae28cdf327d782e629379eee1999096ca2a5d74b (patch) | |
tree | bfe0d4b3a232d75161fe5bba9196553a388fc02a /server/lib/schedulers/videos-redundancy-scheduler.ts | |
parent | d4681c0074ba51c62a3aeb9fb3f2cd071dd21e32 (diff) | |
parent | 8cf998733496d44fa564e2e252356b871756c984 (diff) | |
download | PeerTube-ae28cdf327d782e629379eee1999096ca2a5d74b.tar.gz PeerTube-ae28cdf327d782e629379eee1999096ca2a5d74b.tar.zst PeerTube-ae28cdf327d782e629379eee1999096ca2a5d74b.zip |
Merge from upstream
Diffstat (limited to 'server/lib/schedulers/videos-redundancy-scheduler.ts')
-rw-r--r-- | server/lib/schedulers/videos-redundancy-scheduler.ts | 5 |
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) { |