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/stat-manager.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'server/lib/stat-manager.ts') 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