diff options
author | Chocobozzz <me@florianbigard.com> | 2021-06-01 09:28:45 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-06-01 09:28:45 +0200 |
commit | 1f730800421e578c6056ffbb5fe19857ca550fc2 (patch) | |
tree | 3e3b3f9a227d2986c8c8236f9c9f4bbdf9a2271a /server/lib/stat-manager.ts | |
parent | 86dc0b9cc9374cba7548bb613ff43d92f90570a8 (diff) | |
download | PeerTube-1f730800421e578c6056ffbb5fe19857ca550fc2.tar.gz PeerTube-1f730800421e578c6056ffbb5fe19857ca550fc2.tar.zst PeerTube-1f730800421e578c6056ffbb5fe19857ca550fc2.zip |
Process redundancy stats in series
Diffstat (limited to 'server/lib/stat-manager.ts')
-rw-r--r-- | server/lib/stat-manager.ts | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/server/lib/stat-manager.ts b/server/lib/stat-manager.ts index 09ba208bd..5d703f610 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' | |||
8 | import { VideoFileModel } from '@server/models/video/video-file' | 8 | import { VideoFileModel } from '@server/models/video/video-file' |
9 | import { VideoPlaylistModel } from '@server/models/video/video-playlist' | 9 | import { VideoPlaylistModel } from '@server/models/video/video-playlist' |
10 | import { ActivityType, ServerStats, VideoRedundancyStrategyWithManual } from '@shared/models' | 10 | import { ActivityType, ServerStats, VideoRedundancyStrategyWithManual } from '@shared/models' |
11 | import * as Bluebird from 'bluebird' | ||
11 | 12 | ||
12 | class StatsManager { | 13 | class StatsManager { |
13 | 14 | ||
@@ -106,12 +107,10 @@ class StatsManager { | |||
106 | 107 | ||
107 | strategies.push({ strategy: 'manual', size: null }) | 108 | strategies.push({ strategy: 'manual', size: null }) |
108 | 109 | ||
109 | return Promise.all( | 110 | return Bluebird.mapSeries(strategies, r => { |
110 | strategies.map(r => { | 111 | return VideoRedundancyModel.getStats(r.strategy) |
111 | return VideoRedundancyModel.getStats(r.strategy) | 112 | .then(stats => Object.assign(stats, { strategy: r.strategy, totalSize: r.size })) |
112 | .then(stats => Object.assign(stats, { strategy: r.strategy, totalSize: r.size })) | 113 | }) |
113 | }) | ||
114 | ) | ||
115 | } | 114 | } |
116 | 115 | ||
117 | private buildAPPerType () { | 116 | private buildAPPerType () { |