# Once you have defined your strategies, choose which instances you want to cache in admin -> manage follows -> following
redundancy:
videos:
-# -
-# size: '10GB'
-# strategy: 'most-views' # Cache videos that have the most views
-# -
-# size: '10GB'
-# strategy: 'trending' # Cache trending videos
-# -
-# size: '10GB'
-# strategy: 'recently-added' # Cache recently added videos
-# minViews: 10 # Having at least x views
+ strategies:
+# -
+# size: '10GB'
+# strategy: 'most-views' # Cache videos that have the most views
+# -
+# size: '10GB'
+# strategy: 'trending' # Cache trending videos
+# -
+# size: '10GB'
+# strategy: 'recently-added' # Cache recently added videos
+# minViews: 10 # Having at least x views
cache:
previews:
# Once you have defined your strategies, choose which instances you want to cache in admin -> manage follows -> following
redundancy:
videos:
-# -
-# size: '10GB'
-# strategy: 'most-views' # Cache videos that have the most views
-# -
-# size: '10GB'
-# strategy: 'trending' # Cache trending videos
-# -
-# size: '10GB'
-# strategy: 'recently-added' # Cache recently added videos
-# minViews: 10 # Having at least x views
+ strategies:
+# -
+# size: '10GB'
+# strategy: 'most-views' # Cache videos that have the most views
+# -
+# size: '10GB'
+# strategy: 'trending' # Cache trending videos
+# -
+# size: '10GB'
+# strategy: 'recently-added' # Cache recently added videos
+# minViews: 10 # Having at least x views
###############################################################################
#
redundancy:
videos:
- -
- size: '10MB'
- strategy: 'most-views'
- -
- size: '10MB'
- strategy: 'trending'
- -
- size: '10MB'
- strategy: 'recently-added'
- minViews: 1
+ strategies:
+ -
+ size: '10MB'
+ strategy: 'most-views'
+ -
+ size: '10MB'
+ strategy: 'trending'
+ -
+ size: '10MB'
+ strategy: 'recently-added'
+ minViews: 1
cache:
previews:
const { totalInstanceFollowers, totalInstanceFollowing } = await ActorFollowModel.getStats()
const videosRedundancyStats = await Promise.all(
- CONFIG.REDUNDANCY.VIDEOS.map(r => {
+ CONFIG.REDUNDANCY.VIDEOS.STRATEGIES.map(r => {
return VideoRedundancyModel.getStats(r.strategy)
.then(stats => Object.assign(stats, { strategy: r.strategy, totalSize: r.size }))
})
}
// Redundancies
- const redundancyVideos = config.get<VideosRedundancy[]>('redundancy.videos')
+ const redundancyVideos = config.get<VideosRedundancy[]>('redundancy.videos.strategies')
if (isArray(redundancyVideos)) {
for (const r of redundancyVideos) {
if ([ 'most-views', 'trending', 'recently-added' ].indexOf(r.strategy) === -1) {
'cache.previews.size', 'admin.email',
'signup.enabled', 'signup.limit', 'signup.requires_email_verification',
'signup.filters.cidr.whitelist', 'signup.filters.cidr.blacklist',
+ 'redundancy.videos.strategies',
'transcoding.enabled', 'transcoding.threads',
'import.videos.http.enabled', 'import.videos.torrent.enabled',
'trending.videos.interval_days',
}
},
REDUNDANCY: {
- VIDEOS: buildVideosRedundancy(config.get<any[]>('redundancy.videos'))
+ VIDEOS: {
+ STRATEGIES: buildVideosRedundancy(config.get<any[]>('redundancy.videos.strategies'))
+ }
},
ADMIN: {
get EMAIL () { return config.get<string>('admin.email') }
created = true
}
+ if (actor.Account) actor.Account.Actor = actor
+ if (actor.VideoChannel) actor.VideoChannel.Actor = actor
+
const { actor: actorRefreshed, refreshed } = await retryTransactionWrapper(refreshActorIfNeeded, actor, fetchType)
if (!actorRefreshed) throw new Error('Actor ' + actorRefreshed.url + ' does not exist anymore.')
import { AbstractScheduler } from './abstract-scheduler'
import { CONFIG, JOB_TTL, REDUNDANCY, SCHEDULER_INTERVALS_MS } from '../../initializers'
import { logger } from '../../helpers/logger'
-import { RecentlyAddedStrategy, VideoRedundancyStrategy, VideosRedundancy } from '../../../shared/models/redundancy'
+import { VideoRedundancyStrategy, VideosRedundancy } from '../../../shared/models/redundancy'
import { VideoRedundancyModel } from '../../models/redundancy/video-redundancy'
import { VideoFileModel } from '../../models/video/video-file'
-import { sortBy } from 'lodash'
import { downloadWebTorrentVideo } from '../../helpers/webtorrent'
import { join } from 'path'
import { rename } from 'fs-extra'
import { sendCreateCacheFile, sendUpdateCacheFile } from '../activitypub/send'
import { VideoModel } from '../../models/video/video'
import { getVideoCacheFileActivityPubUrl } from '../activitypub/url'
-import { removeVideoRedundancy } from '../redundancy'
import { isTestInstance } from '../../helpers/core-utils'
export class VideosRedundancyScheduler extends AbstractScheduler {
this.executing = true
- for (const obj of CONFIG.REDUNDANCY.VIDEOS) {
+ for (const obj of CONFIG.REDUNDANCY.VIDEOS.STRATEGIES) {
try {
const videoToDuplicate = await this.findVideoToDuplicate(obj)
if (!videoToDuplicate) continue
},
defaults: {
name: tag
- }
+ },
+ transaction
}
- if (transaction) query['transaction'] = transaction
-
const promise = TagModel.findOrCreate(query)
.then(([ tagInstance ]) => tagInstance)
tasks.push(promise)