]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/stat-manager.ts
Improve target bitrate calculation
[github/Chocobozzz/PeerTube.git] / server / lib / stat-manager.ts
index 09ba208bdd3c43fa94e82735bfebb4cbe312dd1f..3c5e0a93e0046d3940c26b7c5b83672541d00348 100644 (file)
@@ -1,6 +1,6 @@
 import { CONFIG } from '@server/initializers/config'
-import { UserModel } from '@server/models/account/user'
-import { ActorFollowModel } from '@server/models/activitypub/actor-follow'
+import { UserModel } from '@server/models/user/user'
+import { ActorFollowModel } from '@server/models/actor/actor-follow'
 import { VideoRedundancyModel } from '@server/models/redundancy/video-redundancy'
 import { VideoModel } from '@server/models/video/video'
 import { VideoChannelModel } from '@server/models/video/video-channel'
@@ -8,6 +8,7 @@ import { VideoCommentModel } from '@server/models/video/video-comment'
 import { VideoFileModel } from '@server/models/video/video-file'
 import { VideoPlaylistModel } from '@server/models/video/video-playlist'
 import { ActivityType, ServerStats, VideoRedundancyStrategyWithManual } from '@shared/models'
+import * as Bluebird from 'bluebird'
 
 class StatsManager {
 
@@ -106,12 +107,10 @@ class StatsManager {
 
     strategies.push({ strategy: 'manual', size: null })
 
-    return Promise.all(
-      strategies.map(r => {
-        return VideoRedundancyModel.getStats(r.strategy)
-          .then(stats => Object.assign(stats, { strategy: r.strategy, totalSize: r.size }))
-      })
-    )
+    return Bluebird.mapSeries(strategies, r => {
+      return VideoRedundancyModel.getStats(r.strategy)
+        .then(stats => Object.assign(stats, { strategy: r.strategy, totalSize: r.size }))
+    })
   }
 
   private buildAPPerType () {