- private findVideoToDuplicate (strategy: VideoRedundancyStrategy) {
- if (strategy === 'most-views') return VideoRedundancyModel.findMostViewToDuplicate(REDUNDANCY.VIDEOS.RANDOMIZED_FACTOR)
+ private findVideoToDuplicate (cache: VideosRedundancy) {
+ if (cache.strategy === 'most-views') {
+ return VideoRedundancyModel.findMostViewToDuplicate(REDUNDANCY.VIDEOS.RANDOMIZED_FACTOR)
+ }
+
+ if (cache.strategy === 'trending') {
+ return VideoRedundancyModel.findTrendingToDuplicate(REDUNDANCY.VIDEOS.RANDOMIZED_FACTOR)
+ }
+
+ if (cache.strategy === 'recently-added') {
+ const minViews = cache.minViews
+ return VideoRedundancyModel.findRecentlyAddedToDuplicate(REDUNDANCY.VIDEOS.RANDOMIZED_FACTOR, minViews)
+ }