From 030177d246834fdba89be9bbaeac497589b47102 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 15 Nov 2018 16:18:12 +0100 Subject: Don't forward view, send updates instead To avoid inconsistencies in the federation, now the origin server will tell other instances what is the correct number of views --- server/lib/job-queue/handlers/video-views.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'server/lib/job-queue/handlers/video-views.ts') diff --git a/server/lib/job-queue/handlers/video-views.ts b/server/lib/job-queue/handlers/video-views.ts index cf180a11a..2ceec2342 100644 --- a/server/lib/job-queue/handlers/video-views.ts +++ b/server/lib/job-queue/handlers/video-views.ts @@ -3,8 +3,9 @@ import { logger } from '../../../helpers/logger' import { VideoModel } from '../../../models/video/video' import { VideoViewModel } from '../../../models/video/video-views' import { isTestInstance } from '../../../helpers/core-utils' +import { federateVideoIfNeeded } from '../../activitypub' -async function processVideosViewsViews () { +async function processVideosViews () { const lastHour = new Date() // In test mode, we run this function multiple times per hour, so we don't want the values of the previous hour @@ -36,6 +37,9 @@ async function processVideosViewsViews () { views, videoId }) + + const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(videoId) + await federateVideoIfNeeded(video, false) } catch (err) { logger.debug('Cannot create video views for video %d in hour %d. Maybe the video does not exist anymore?', videoId, hour) } @@ -51,5 +55,5 @@ async function processVideosViewsViews () { // --------------------------------------------------------------------------- export { - processVideosViewsViews + processVideosViews } -- cgit v1.2.3