]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Process redundancy stats in series
authorChocobozzz <me@florianbigard.com>
Tue, 1 Jun 2021 07:28:45 +0000 (09:28 +0200)
committerChocobozzz <me@florianbigard.com>
Tue, 1 Jun 2021 09:03:52 +0000 (11:03 +0200)
server/lib/activitypub/videos.ts
server/lib/stat-manager.ts

index 15726f90be25cb0b2d19cebba31eae1638d305bb..127a0dd8a1ef561357faf43ec58bb05aa0ac12c2 100644 (file)
@@ -336,7 +336,7 @@ async function updateVideoFromAP (options: {
       }
 
       const to = overrideTo || videoObject.to
-      const videoData = await videoActivityObjectToDBAttributes(channel, videoObject, to)
+      const videoData = videoActivityObjectToDBAttributes(channel, videoObject, to)
       video.name = videoData.name
       video.uuid = videoData.uuid
       video.url = videoData.url
index 25ed2192742ab49f4c33ea5ae25bf81a0026dd27..3c5e0a93e0046d3940c26b7c5b83672541d00348 100644 (file)
@@ -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 () {