aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/job-queue
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/job-queue')
-rw-r--r--server/lib/job-queue/handlers/activitypub-http-fetcher.ts21
1 files changed, 10 insertions, 11 deletions
diff --git a/server/lib/job-queue/handlers/activitypub-http-fetcher.ts b/server/lib/job-queue/handlers/activitypub-http-fetcher.ts
index a7c1a556c..e210ac3ef 100644
--- a/server/lib/job-queue/handlers/activitypub-http-fetcher.ts
+++ b/server/lib/job-queue/handlers/activitypub-http-fetcher.ts
@@ -1,19 +1,18 @@
1import * as Bull from 'bull' 1import * as Bull from 'bull'
2import * as Bluebird from 'bluebird' 2import { ActivitypubHttpFetcherPayload, FetchType } from '@shared/models'
3import { logger } from '../../../helpers/logger' 3import { logger } from '../../../helpers/logger'
4import { processActivities } from '../../activitypub/process'
5import { addVideoComments } from '../../activitypub/video-comments'
6import { crawlCollectionPage } from '../../activitypub/crawl'
7import { VideoModel } from '../../../models/video/video'
8import { addVideoShares } from '../../activitypub/share'
9import { createRates } from '../../activitypub/video-rates'
10import { createAccountPlaylists } from '../../activitypub/playlist'
11import { AccountModel } from '../../../models/account/account' 4import { AccountModel } from '../../../models/account/account'
12import { AccountVideoRateModel } from '../../../models/account/account-video-rate' 5import { AccountVideoRateModel } from '../../../models/account/account-video-rate'
13import { VideoShareModel } from '../../../models/video/video-share' 6import { VideoModel } from '../../../models/video/video'
14import { VideoCommentModel } from '../../../models/video/video-comment' 7import { VideoCommentModel } from '../../../models/video/video-comment'
8import { VideoShareModel } from '../../../models/video/video-share'
15import { MAccountDefault, MVideoFullLight } from '../../../types/models' 9import { MAccountDefault, MVideoFullLight } from '../../../types/models'
16import { ActivitypubHttpFetcherPayload, FetchType } from '@shared/models' 10import { crawlCollectionPage } from '../../activitypub/crawl'
11import { createAccountPlaylists } from '../../activitypub/playlist'
12import { processActivities } from '../../activitypub/process'
13import { addVideoShares } from '../../activitypub/share'
14import { addVideoComments } from '../../activitypub/video-comments'
15import { createRates } from '../../activitypub/video-rates'
17 16
18async function processActivityPubHttpFetcher (job: Bull.Job) { 17async function processActivityPubHttpFetcher (job: Bull.Job) {
19 logger.info('Processing ActivityPub fetcher in job %d.', job.id) 18 logger.info('Processing ActivityPub fetcher in job %d.', job.id)
@@ -35,7 +34,7 @@ async function processActivityPubHttpFetcher (job: Bull.Job) {
35 'account-playlists': items => createAccountPlaylists(items, account) 34 'account-playlists': items => createAccountPlaylists(items, account)
36 } 35 }
37 36
38 const cleanerType: { [ id in FetchType ]?: (crawlStartDate: Date) => Bluebird<any> } = { 37 const cleanerType: { [ id in FetchType ]?: (crawlStartDate: Date) => Promise<any> } = {
39 'video-likes': crawlStartDate => AccountVideoRateModel.cleanOldRatesOf(video.id, 'like' as 'like', crawlStartDate), 38 'video-likes': crawlStartDate => AccountVideoRateModel.cleanOldRatesOf(video.id, 'like' as 'like', crawlStartDate),
40 'video-dislikes': crawlStartDate => AccountVideoRateModel.cleanOldRatesOf(video.id, 'dislike' as 'dislike', crawlStartDate), 39 'video-dislikes': crawlStartDate => AccountVideoRateModel.cleanOldRatesOf(video.id, 'dislike' as 'dislike', crawlStartDate),
41 'video-shares': crawlStartDate => VideoShareModel.cleanOldSharesOf(video.id, crawlStartDate), 40 'video-shares': crawlStartDate => VideoShareModel.cleanOldSharesOf(video.id, crawlStartDate),