aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/job-queue/handlers/video-views.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-11-15 16:18:12 +0100
committerChocobozzz <me@florianbigard.com>2018-11-15 16:38:37 +0100
commit030177d246834fdba89be9bbaeac497589b47102 (patch)
treea0c5b2e59aeb01322cff9042ceb31d49aadda908 /server/lib/job-queue/handlers/video-views.ts
parent650e3d5ce380026cc79bcd271915cf7e6f51c24c (diff)
downloadPeerTube-030177d246834fdba89be9bbaeac497589b47102.tar.gz
PeerTube-030177d246834fdba89be9bbaeac497589b47102.tar.zst
PeerTube-030177d246834fdba89be9bbaeac497589b47102.zip
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
Diffstat (limited to 'server/lib/job-queue/handlers/video-views.ts')
-rw-r--r--server/lib/job-queue/handlers/video-views.ts8
1 files changed, 6 insertions, 2 deletions
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'
3import { VideoModel } from '../../../models/video/video' 3import { VideoModel } from '../../../models/video/video'
4import { VideoViewModel } from '../../../models/video/video-views' 4import { VideoViewModel } from '../../../models/video/video-views'
5import { isTestInstance } from '../../../helpers/core-utils' 5import { isTestInstance } from '../../../helpers/core-utils'
6import { federateVideoIfNeeded } from '../../activitypub'
6 7
7async function processVideosViewsViews () { 8async function processVideosViews () {
8 const lastHour = new Date() 9 const lastHour = new Date()
9 10
10 // In test mode, we run this function multiple times per hour, so we don't want the values of the previous hour 11 // 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 () {
36 views, 37 views,
37 videoId 38 videoId
38 }) 39 })
40
41 const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(videoId)
42 await federateVideoIfNeeded(video, false)
39 } catch (err) { 43 } catch (err) {
40 logger.debug('Cannot create video views for video %d in hour %d. Maybe the video does not exist anymore?', videoId, hour) 44 logger.debug('Cannot create video views for video %d in hour %d. Maybe the video does not exist anymore?', videoId, hour)
41 } 45 }
@@ -51,5 +55,5 @@ async function processVideosViewsViews () {
51// --------------------------------------------------------------------------- 55// ---------------------------------------------------------------------------
52 56
53export { 57export {
54 processVideosViewsViews 58 processVideosViews
55} 59}