Fix redundancy exceeded quota
authorChocobozzz <me@florianbigard.com>
Thu, 20 Jun 2019 08:33:01 +0000 (10:33 +0200)
committerChocobozzz <me@florianbigard.com>
Thu, 20 Jun 2019 08:33:01 +0000 (10:33 +0200)
server/lib/schedulers/videos-redundancy-scheduler.ts

index 01af1e9d2a92020c54242c7bf37d55d2ab501040..90caed96d3ca920d298183a2302d4379082ee332 100644 (file)
@@ -269,7 +269,10 @@ export class VideosRedundancyScheduler extends AbstractScheduler {
   private getTotalFileSizes (files: VideoFileModel[], playlists: VideoStreamingPlaylistModel[]) {
     const fileReducer = (previous: number, current: VideoFileModel) => previous + current.size
 
-    return files.reduce(fileReducer, 0) * playlists.length
+    const totalSize = files.reduce(fileReducer, 0)
+    if (playlists.length === 0) return totalSize
+
+    return totalSize * playlists.length
   }
 
   private async loadAndRefreshVideo (videoUrl: string) {