diff options
author | buoyantair <buoyantair@protonmail.com> | 2018-11-16 02:37:16 +0530 |
---|---|---|
committer | buoyantair <buoyantair@protonmail.com> | 2018-11-16 02:37:16 +0530 |
commit | ae28cdf327d782e629379eee1999096ca2a5d74b (patch) | |
tree | bfe0d4b3a232d75161fe5bba9196553a388fc02a /server/lib/job-queue/handlers/video-views.ts | |
parent | d4681c0074ba51c62a3aeb9fb3f2cd071dd21e32 (diff) | |
parent | 8cf998733496d44fa564e2e252356b871756c984 (diff) | |
download | PeerTube-ae28cdf327d782e629379eee1999096ca2a5d74b.tar.gz PeerTube-ae28cdf327d782e629379eee1999096ca2a5d74b.tar.zst PeerTube-ae28cdf327d782e629379eee1999096ca2a5d74b.zip |
Merge from upstream
Diffstat (limited to 'server/lib/job-queue/handlers/video-views.ts')
-rw-r--r-- | server/lib/job-queue/handlers/video-views.ts | 8 |
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..f44c3c727 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' | |||
3 | import { VideoModel } from '../../../models/video/video' | 3 | import { VideoModel } from '../../../models/video/video' |
4 | import { VideoViewModel } from '../../../models/video/video-views' | 4 | import { VideoViewModel } from '../../../models/video/video-views' |
5 | import { isTestInstance } from '../../../helpers/core-utils' | 5 | import { isTestInstance } from '../../../helpers/core-utils' |
6 | import { federateVideoIfNeeded } from '../../activitypub' | ||
6 | 7 | ||
7 | async function processVideosViewsViews () { | 8 | async 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 | if (video.isOwned()) 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 | ||
53 | export { | 57 | export { |
54 | processVideosViewsViews | 58 | processVideosViews |
55 | } | 59 | } |