Only duplicate public videos

pull/1119/head
Chocobozzz 2018-09-25 18:05:54 +02:00
parent c922d14220
commit 4a08f66927
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
2 changed files with 9 additions and 2 deletions

View File

@ -119,7 +119,7 @@ const JOB_TTL: { [ id in JobType ]: number } = {
'activitypub-follow': 60000 * 10, // 10 minutes 'activitypub-follow': 60000 * 10, // 10 minutes
'video-file-import': 1000 * 3600, // 1 hour 'video-file-import': 1000 * 3600, // 1 hour
'video-file': 1000 * 3600 * 48, // 2 days, transcoding could be long 'video-file': 1000 * 3600 * 48, // 2 days, transcoding could be long
'video-import': 1000 * 3600 * 5, // 1 hour 'video-import': 1000 * 3600, // 1 hour
'email': 60000 * 10, // 10 minutes 'email': 60000 * 10, // 10 minutes
'videos-views': undefined // Unlimited 'videos-views': undefined // Unlimited
} }

View File

@ -21,7 +21,7 @@ import { getServerActor } from '../../helpers/utils'
import { VideoModel } from '../video/video' import { VideoModel } from '../video/video'
import { VideoRedundancyStrategy } from '../../../shared/models/redundancy' import { VideoRedundancyStrategy } from '../../../shared/models/redundancy'
import { logger } from '../../helpers/logger' import { logger } from '../../helpers/logger'
import { CacheFileObject } from '../../../shared' import { CacheFileObject, VideoPrivacy } from '../../../shared'
import { VideoChannelModel } from '../video/video-channel' import { VideoChannelModel } from '../video/video-channel'
import { ServerModel } from '../server/server' import { ServerModel } from '../server/server'
import { sample } from 'lodash' import { sample } from 'lodash'
@ -160,6 +160,9 @@ export class VideoRedundancyModel extends Model<VideoRedundancyModel> {
attributes: [ 'id', 'views' ], attributes: [ 'id', 'views' ],
limit: randomizedFactor, limit: randomizedFactor,
order: getVideoSort('-views'), order: getVideoSort('-views'),
where: {
privacy: VideoPrivacy.PUBLIC
},
include: [ include: [
await VideoRedundancyModel.buildVideoFileForDuplication(), await VideoRedundancyModel.buildVideoFileForDuplication(),
VideoRedundancyModel.buildServerRedundancyInclude() VideoRedundancyModel.buildServerRedundancyInclude()
@ -177,6 +180,9 @@ export class VideoRedundancyModel extends Model<VideoRedundancyModel> {
group: 'VideoModel.id', group: 'VideoModel.id',
limit: randomizedFactor, limit: randomizedFactor,
order: getVideoSort('-trending'), order: getVideoSort('-trending'),
where: {
privacy: VideoPrivacy.PUBLIC
},
include: [ include: [
await VideoRedundancyModel.buildVideoFileForDuplication(), await VideoRedundancyModel.buildVideoFileForDuplication(),
VideoRedundancyModel.buildServerRedundancyInclude(), VideoRedundancyModel.buildServerRedundancyInclude(),
@ -195,6 +201,7 @@ export class VideoRedundancyModel extends Model<VideoRedundancyModel> {
limit: randomizedFactor, limit: randomizedFactor,
order: getVideoSort('-publishedAt'), order: getVideoSort('-publishedAt'),
where: { where: {
privacy: VideoPrivacy.PUBLIC,
views: { views: {
[ Sequelize.Op.gte ]: minViews [ Sequelize.Op.gte ]: minViews
} }