diff options
author | Chocobozzz <me@florianbigard.com> | 2021-05-26 13:41:15 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-05-26 13:41:15 +0200 |
commit | 8ee37c5f38b0f9b7e97239197d5590109c163250 (patch) | |
tree | d413bfebd188403506372207b26d771714545fbc /server/models/redundancy/video-redundancy.ts | |
parent | 20213fbd2a366dffc35aa7dddad71323893f8d62 (diff) | |
parent | f49b3231d080767128c80dca7630a1ba9950ed12 (diff) | |
download | PeerTube-8ee37c5f38b0f9b7e97239197d5590109c163250.tar.gz PeerTube-8ee37c5f38b0f9b7e97239197d5590109c163250.tar.zst PeerTube-8ee37c5f38b0f9b7e97239197d5590109c163250.zip |
Merge branch 'release/3.2.0' into develop
Diffstat (limited to 'server/models/redundancy/video-redundancy.ts')
-rw-r--r-- | server/models/redundancy/video-redundancy.ts | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/server/models/redundancy/video-redundancy.ts b/server/models/redundancy/video-redundancy.ts index ef780c2a4..f7a989691 100644 --- a/server/models/redundancy/video-redundancy.ts +++ b/server/models/redundancy/video-redundancy.ts | |||
@@ -408,50 +408,6 @@ export class VideoRedundancyModel extends Model<Partial<AttributesOnly<VideoRedu | |||
408 | return VideoRedundancyModel.scope([ ScopeNames.WITH_VIDEO ]).findOne(query) | 408 | return VideoRedundancyModel.scope([ ScopeNames.WITH_VIDEO ]).findOne(query) |
409 | } | 409 | } |
410 | 410 | ||
411 | static async getTotalDuplicated (strategy: VideoRedundancyStrategy) { | ||
412 | const actor = await getServerActor() | ||
413 | const redundancyInclude = { | ||
414 | attributes: [], | ||
415 | model: VideoRedundancyModel, | ||
416 | required: true, | ||
417 | where: { | ||
418 | actorId: actor.id, | ||
419 | strategy | ||
420 | } | ||
421 | } | ||
422 | |||
423 | const queryFiles: FindOptions = { | ||
424 | include: [ redundancyInclude ] | ||
425 | } | ||
426 | |||
427 | const queryStreamingPlaylists: FindOptions = { | ||
428 | include: [ | ||
429 | { | ||
430 | attributes: [], | ||
431 | model: VideoModel.unscoped(), | ||
432 | required: true, | ||
433 | include: [ | ||
434 | { | ||
435 | required: true, | ||
436 | attributes: [], | ||
437 | model: VideoStreamingPlaylistModel.unscoped(), | ||
438 | include: [ | ||
439 | redundancyInclude | ||
440 | ] | ||
441 | } | ||
442 | ] | ||
443 | } | ||
444 | ] | ||
445 | } | ||
446 | |||
447 | return Promise.all([ | ||
448 | VideoFileModel.aggregate('size', 'SUM', queryFiles), | ||
449 | VideoFileModel.aggregate('size', 'SUM', queryStreamingPlaylists) | ||
450 | ]).then(([ r1, r2 ]) => { | ||
451 | return parseAggregateResult(r1) + parseAggregateResult(r2) | ||
452 | }) | ||
453 | } | ||
454 | |||
455 | static async listLocalExpired () { | 411 | static async listLocalExpired () { |
456 | const actor = await getServerActor() | 412 | const actor = await getServerActor() |
457 | 413 | ||