diff options
author | Chocobozzz <me@florianbigard.com> | 2021-06-01 09:28:45 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-06-01 11:03:52 +0200 |
commit | d88a3ea5e368c13be4748b252e57da3d8c66fe84 (patch) | |
tree | 65685d705ff28188346a5ff057fbe11d45eb8ecf /server/lib | |
parent | a7944e89bcd0a58fecc2ebd6a98e1674bd4173bb (diff) | |
download | PeerTube-d88a3ea5e368c13be4748b252e57da3d8c66fe84.tar.gz PeerTube-d88a3ea5e368c13be4748b252e57da3d8c66fe84.tar.zst PeerTube-d88a3ea5e368c13be4748b252e57da3d8c66fe84.zip |
Process redundancy stats in series
Diffstat (limited to 'server/lib')
-rw-r--r-- | server/lib/activitypub/videos.ts | 2 | ||||
-rw-r--r-- | server/lib/stat-manager.ts | 11 |
2 files changed, 6 insertions, 7 deletions
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: { | |||
336 | } | 336 | } |
337 | 337 | ||
338 | const to = overrideTo || videoObject.to | 338 | const to = overrideTo || videoObject.to |
339 | const videoData = await videoActivityObjectToDBAttributes(channel, videoObject, to) | 339 | const videoData = videoActivityObjectToDBAttributes(channel, videoObject, to) |
340 | video.name = videoData.name | 340 | video.name = videoData.name |
341 | video.uuid = videoData.uuid | 341 | video.uuid = videoData.uuid |
342 | video.url = videoData.url | 342 | 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' | |||
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 () { |