Only duplicate public videos
authorChocobozzz <me@florianbigard.com>
Tue, 25 Sep 2018 16:05:54 +0000 (18:05 +0200)
committerChocobozzz <me@florianbigard.com>
Tue, 25 Sep 2018 16:05:54 +0000 (18:05 +0200)
server/initializers/constants.ts
server/models/redundancy/video-redundancy.ts

index 8e019f61e9369b1026033dee834093227b421793..de426c16e0ad35d731d8ac8d7f3c3945d2e17f1c 100644 (file)
@@ -119,7 +119,7 @@ const JOB_TTL: { [ id in JobType ]: number } = {
   'activitypub-follow': 60000 * 10, // 10 minutes
   'video-file-import': 1000 * 3600, // 1 hour
   '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
   'videos-views': undefined // Unlimited
 }
index 58c4f354c311b2cac4a301350b7ef03c83831ade..3c87ec2c13470b70999a98ddf39d723d7c5a37bc 100644 (file)
@@ -21,7 +21,7 @@ import { getServerActor } from '../../helpers/utils'
 import { VideoModel } from '../video/video'
 import { VideoRedundancyStrategy } from '../../../shared/models/redundancy'
 import { logger } from '../../helpers/logger'
-import { CacheFileObject } from '../../../shared'
+import { CacheFileObject, VideoPrivacy } from '../../../shared'
 import { VideoChannelModel } from '../video/video-channel'
 import { ServerModel } from '../server/server'
 import { sample } from 'lodash'
@@ -160,6 +160,9 @@ export class VideoRedundancyModel extends Model<VideoRedundancyModel> {
       attributes: [ 'id', 'views' ],
       limit: randomizedFactor,
       order: getVideoSort('-views'),
+      where: {
+        privacy: VideoPrivacy.PUBLIC
+      },
       include: [
         await VideoRedundancyModel.buildVideoFileForDuplication(),
         VideoRedundancyModel.buildServerRedundancyInclude()
@@ -177,6 +180,9 @@ export class VideoRedundancyModel extends Model<VideoRedundancyModel> {
       group: 'VideoModel.id',
       limit: randomizedFactor,
       order: getVideoSort('-trending'),
+      where: {
+        privacy: VideoPrivacy.PUBLIC
+      },
       include: [
         await VideoRedundancyModel.buildVideoFileForDuplication(),
         VideoRedundancyModel.buildServerRedundancyInclude(),
@@ -195,6 +201,7 @@ export class VideoRedundancyModel extends Model<VideoRedundancyModel> {
       limit: randomizedFactor,
       order: getVideoSort('-publishedAt'),
       where: {
+        privacy: VideoPrivacy.PUBLIC,
         views: {
           [ Sequelize.Op.gte ]: minViews
         }