aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/job-queue/handlers
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/job-queue/handlers')
-rw-r--r--server/lib/job-queue/handlers/activitypub-cleaner.ts2
-rw-r--r--server/lib/job-queue/handlers/activitypub-http-fetcher.ts6
-rw-r--r--server/lib/job-queue/handlers/activitypub-refresher.ts2
3 files changed, 2 insertions, 8 deletions
diff --git a/server/lib/job-queue/handlers/activitypub-cleaner.ts b/server/lib/job-queue/handlers/activitypub-cleaner.ts
index 509dd1cb5..07dd908cd 100644
--- a/server/lib/job-queue/handlers/activitypub-cleaner.ts
+++ b/server/lib/job-queue/handlers/activitypub-cleaner.ts
@@ -34,7 +34,7 @@ async function processActivityPubCleaner (_job: Job) {
34 if (result?.status === 'deleted') { 34 if (result?.status === 'deleted') {
35 const { videoId, type } = result.data 35 const { videoId, type } = result.data
36 36
37 await VideoModel.updateRatesOf(videoId, type, undefined) 37 await VideoModel.syncLocalRates(videoId, type, undefined)
38 } 38 }
39 }, { concurrency: AP_CLEANER.CONCURRENCY }) 39 }, { concurrency: AP_CLEANER.CONCURRENCY })
40 } 40 }
diff --git a/server/lib/job-queue/handlers/activitypub-http-fetcher.ts b/server/lib/job-queue/handlers/activitypub-http-fetcher.ts
index 46016a0a7..128e14f94 100644
--- a/server/lib/job-queue/handlers/activitypub-http-fetcher.ts
+++ b/server/lib/job-queue/handlers/activitypub-http-fetcher.ts
@@ -1,7 +1,6 @@
1import { Job } from 'bull' 1import { Job } from 'bull'
2import { ActivitypubHttpFetcherPayload, FetchType } from '@shared/models' 2import { ActivitypubHttpFetcherPayload, FetchType } from '@shared/models'
3import { logger } from '../../../helpers/logger' 3import { logger } from '../../../helpers/logger'
4import { AccountVideoRateModel } from '../../../models/account/account-video-rate'
5import { VideoModel } from '../../../models/video/video' 4import { VideoModel } from '../../../models/video/video'
6import { VideoCommentModel } from '../../../models/video/video-comment' 5import { VideoCommentModel } from '../../../models/video/video-comment'
7import { VideoShareModel } from '../../../models/video/video-share' 6import { VideoShareModel } from '../../../models/video/video-share'
@@ -11,7 +10,6 @@ import { createAccountPlaylists } from '../../activitypub/playlists'
11import { processActivities } from '../../activitypub/process' 10import { processActivities } from '../../activitypub/process'
12import { addVideoShares } from '../../activitypub/share' 11import { addVideoShares } from '../../activitypub/share'
13import { addVideoComments } from '../../activitypub/video-comments' 12import { addVideoComments } from '../../activitypub/video-comments'
14import { createRates } from '../../activitypub/video-rates'
15 13
16async function processActivityPubHttpFetcher (job: Job) { 14async function processActivityPubHttpFetcher (job: Job) {
17 logger.info('Processing ActivityPub fetcher in job %d.', job.id) 15 logger.info('Processing ActivityPub fetcher in job %d.', job.id)
@@ -23,16 +21,12 @@ async function processActivityPubHttpFetcher (job: Job) {
23 21
24 const fetcherType: { [ id in FetchType ]: (items: any[]) => Promise<any> } = { 22 const fetcherType: { [ id in FetchType ]: (items: any[]) => Promise<any> } = {
25 'activity': items => processActivities(items, { outboxUrl: payload.uri, fromFetch: true }), 23 'activity': items => processActivities(items, { outboxUrl: payload.uri, fromFetch: true }),
26 'video-likes': items => createRates(items, video, 'like'),
27 'video-dislikes': items => createRates(items, video, 'dislike'),
28 'video-shares': items => addVideoShares(items, video), 24 'video-shares': items => addVideoShares(items, video),
29 'video-comments': items => addVideoComments(items), 25 'video-comments': items => addVideoComments(items),
30 'account-playlists': items => createAccountPlaylists(items) 26 'account-playlists': items => createAccountPlaylists(items)
31 } 27 }
32 28
33 const cleanerType: { [ id in FetchType ]?: (crawlStartDate: Date) => Promise<any> } = { 29 const cleanerType: { [ id in FetchType ]?: (crawlStartDate: Date) => Promise<any> } = {
34 'video-likes': crawlStartDate => AccountVideoRateModel.cleanOldRatesOf(video.id, 'like' as 'like', crawlStartDate),
35 'video-dislikes': crawlStartDate => AccountVideoRateModel.cleanOldRatesOf(video.id, 'dislike' as 'dislike', crawlStartDate),
36 'video-shares': crawlStartDate => VideoShareModel.cleanOldSharesOf(video.id, crawlStartDate), 30 'video-shares': crawlStartDate => VideoShareModel.cleanOldSharesOf(video.id, crawlStartDate),
37 'video-comments': crawlStartDate => VideoCommentModel.cleanOldCommentsOf(video.id, crawlStartDate) 31 'video-comments': crawlStartDate => VideoCommentModel.cleanOldCommentsOf(video.id, crawlStartDate)
38 } 32 }
diff --git a/server/lib/job-queue/handlers/activitypub-refresher.ts b/server/lib/job-queue/handlers/activitypub-refresher.ts
index 5037992d2..92ceed180 100644
--- a/server/lib/job-queue/handlers/activitypub-refresher.ts
+++ b/server/lib/job-queue/handlers/activitypub-refresher.ts
@@ -28,7 +28,7 @@ export {
28 28
29async function refreshVideo (videoUrl: string) { 29async function refreshVideo (videoUrl: string) {
30 const fetchType = 'all' as 'all' 30 const fetchType = 'all' as 'all'
31 const syncParam = { likes: true, dislikes: true, shares: true, comments: true, thumbnail: true } 31 const syncParam = { rates: true, shares: true, comments: true, thumbnail: true }
32 32
33 const videoFromDatabase = await loadVideoByUrl(videoUrl, fetchType) 33 const videoFromDatabase = await loadVideoByUrl(videoUrl, fetchType)
34 if (videoFromDatabase) { 34 if (videoFromDatabase) {