diff options
Diffstat (limited to 'server/lib/job-queue/handlers')
-rw-r--r-- | server/lib/job-queue/handlers/activitypub-http-fetcher.ts | 21 |
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 @@ | |||
1 | import * as Bull from 'bull' | 1 | import * as Bull from 'bull' |
2 | import * as Bluebird from 'bluebird' | 2 | import { ActivitypubHttpFetcherPayload, FetchType } from '@shared/models' |
3 | import { logger } from '../../../helpers/logger' | 3 | import { logger } from '../../../helpers/logger' |
4 | import { processActivities } from '../../activitypub/process' | ||
5 | import { addVideoComments } from '../../activitypub/video-comments' | ||
6 | import { crawlCollectionPage } from '../../activitypub/crawl' | ||
7 | import { VideoModel } from '../../../models/video/video' | ||
8 | import { addVideoShares } from '../../activitypub/share' | ||
9 | import { createRates } from '../../activitypub/video-rates' | ||
10 | import { createAccountPlaylists } from '../../activitypub/playlist' | ||
11 | import { AccountModel } from '../../../models/account/account' | 4 | import { AccountModel } from '../../../models/account/account' |
12 | import { AccountVideoRateModel } from '../../../models/account/account-video-rate' | 5 | import { AccountVideoRateModel } from '../../../models/account/account-video-rate' |
13 | import { VideoShareModel } from '../../../models/video/video-share' | 6 | import { VideoModel } from '../../../models/video/video' |
14 | import { VideoCommentModel } from '../../../models/video/video-comment' | 7 | import { VideoCommentModel } from '../../../models/video/video-comment' |
8 | import { VideoShareModel } from '../../../models/video/video-share' | ||
15 | import { MAccountDefault, MVideoFullLight } from '../../../types/models' | 9 | import { MAccountDefault, MVideoFullLight } from '../../../types/models' |
16 | import { ActivitypubHttpFetcherPayload, FetchType } from '@shared/models' | 10 | import { crawlCollectionPage } from '../../activitypub/crawl' |
11 | import { createAccountPlaylists } from '../../activitypub/playlist' | ||
12 | import { processActivities } from '../../activitypub/process' | ||
13 | import { addVideoShares } from '../../activitypub/share' | ||
14 | import { addVideoComments } from '../../activitypub/video-comments' | ||
15 | import { createRates } from '../../activitypub/video-rates' | ||
17 | 16 | ||
18 | async function processActivityPubHttpFetcher (job: Bull.Job) { | 17 | async 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), |