diff options
author | Chocobozzz <me@florianbigard.com> | 2018-09-25 18:05:54 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-09-25 18:05:54 +0200 |
commit | 4a08f6692780fa5147d85126af3089fc7891e436 (patch) | |
tree | aa65e7649929de46fb3add06dba5550da7232000 | |
parent | c922d14220eed241d47677db8441921935435f0c (diff) | |
download | PeerTube-4a08f6692780fa5147d85126af3089fc7891e436.tar.gz PeerTube-4a08f6692780fa5147d85126af3089fc7891e436.tar.zst PeerTube-4a08f6692780fa5147d85126af3089fc7891e436.zip |
Only duplicate public videos
-rw-r--r-- | server/initializers/constants.ts | 2 | ||||
-rw-r--r-- | server/models/redundancy/video-redundancy.ts | 9 |
2 files changed, 9 insertions, 2 deletions
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index 8e019f61e..de426c16e 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts | |||
@@ -119,7 +119,7 @@ const JOB_TTL: { [ id in JobType ]: number } = { | |||
119 | 'activitypub-follow': 60000 * 10, // 10 minutes | 119 | 'activitypub-follow': 60000 * 10, // 10 minutes |
120 | 'video-file-import': 1000 * 3600, // 1 hour | 120 | 'video-file-import': 1000 * 3600, // 1 hour |
121 | 'video-file': 1000 * 3600 * 48, // 2 days, transcoding could be long | 121 | 'video-file': 1000 * 3600 * 48, // 2 days, transcoding could be long |
122 | 'video-import': 1000 * 3600 * 5, // 1 hour | 122 | 'video-import': 1000 * 3600, // 1 hour |
123 | 'email': 60000 * 10, // 10 minutes | 123 | 'email': 60000 * 10, // 10 minutes |
124 | 'videos-views': undefined // Unlimited | 124 | 'videos-views': undefined // Unlimited |
125 | } | 125 | } |
diff --git a/server/models/redundancy/video-redundancy.ts b/server/models/redundancy/video-redundancy.ts index 58c4f354c..3c87ec2c1 100644 --- a/server/models/redundancy/video-redundancy.ts +++ b/server/models/redundancy/video-redundancy.ts | |||
@@ -21,7 +21,7 @@ import { getServerActor } from '../../helpers/utils' | |||
21 | import { VideoModel } from '../video/video' | 21 | import { VideoModel } from '../video/video' |
22 | import { VideoRedundancyStrategy } from '../../../shared/models/redundancy' | 22 | import { VideoRedundancyStrategy } from '../../../shared/models/redundancy' |
23 | import { logger } from '../../helpers/logger' | 23 | import { logger } from '../../helpers/logger' |
24 | import { CacheFileObject } from '../../../shared' | 24 | import { CacheFileObject, VideoPrivacy } from '../../../shared' |
25 | import { VideoChannelModel } from '../video/video-channel' | 25 | import { VideoChannelModel } from '../video/video-channel' |
26 | import { ServerModel } from '../server/server' | 26 | import { ServerModel } from '../server/server' |
27 | import { sample } from 'lodash' | 27 | import { sample } from 'lodash' |
@@ -160,6 +160,9 @@ export class VideoRedundancyModel extends Model<VideoRedundancyModel> { | |||
160 | attributes: [ 'id', 'views' ], | 160 | attributes: [ 'id', 'views' ], |
161 | limit: randomizedFactor, | 161 | limit: randomizedFactor, |
162 | order: getVideoSort('-views'), | 162 | order: getVideoSort('-views'), |
163 | where: { | ||
164 | privacy: VideoPrivacy.PUBLIC | ||
165 | }, | ||
163 | include: [ | 166 | include: [ |
164 | await VideoRedundancyModel.buildVideoFileForDuplication(), | 167 | await VideoRedundancyModel.buildVideoFileForDuplication(), |
165 | VideoRedundancyModel.buildServerRedundancyInclude() | 168 | VideoRedundancyModel.buildServerRedundancyInclude() |
@@ -177,6 +180,9 @@ export class VideoRedundancyModel extends Model<VideoRedundancyModel> { | |||
177 | group: 'VideoModel.id', | 180 | group: 'VideoModel.id', |
178 | limit: randomizedFactor, | 181 | limit: randomizedFactor, |
179 | order: getVideoSort('-trending'), | 182 | order: getVideoSort('-trending'), |
183 | where: { | ||
184 | privacy: VideoPrivacy.PUBLIC | ||
185 | }, | ||
180 | include: [ | 186 | include: [ |
181 | await VideoRedundancyModel.buildVideoFileForDuplication(), | 187 | await VideoRedundancyModel.buildVideoFileForDuplication(), |
182 | VideoRedundancyModel.buildServerRedundancyInclude(), | 188 | VideoRedundancyModel.buildServerRedundancyInclude(), |
@@ -195,6 +201,7 @@ export class VideoRedundancyModel extends Model<VideoRedundancyModel> { | |||
195 | limit: randomizedFactor, | 201 | limit: randomizedFactor, |
196 | order: getVideoSort('-publishedAt'), | 202 | order: getVideoSort('-publishedAt'), |
197 | where: { | 203 | where: { |
204 | privacy: VideoPrivacy.PUBLIC, | ||
198 | views: { | 205 | views: { |
199 | [ Sequelize.Op.gte ]: minViews | 206 | [ Sequelize.Op.gte ]: minViews |
200 | } | 207 | } |