From d88a3ea5e368c13be4748b252e57da3d8c66fe84 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 1 Jun 2021 09:28:45 +0200 Subject: Process redundancy stats in series --- server/lib/activitypub/videos.ts | 2 +- server/lib/stat-manager.ts | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) (limited to 'server/lib') diff --git a/server/lib/activitypub/videos.ts b/server/lib/activitypub/videos.ts index 15726f90b..127a0dd8a 100644 --- a/server/lib/activitypub/videos.ts +++ b/server/lib/activitypub/videos.ts @@ -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 diff --git a/server/lib/stat-manager.ts b/server/lib/stat-manager.ts index 25ed21927..3c5e0a93e 100644 --- a/server/lib/stat-manager.ts +++ b/server/lib/stat-manager.ts @@ -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 () { -- cgit v1.2.3