diff options
Diffstat (limited to 'server/lib/job-queue/handlers')
-rw-r--r-- | server/lib/job-queue/handlers/activitypub-cleaner.ts | 2 | ||||
-rw-r--r-- | server/lib/job-queue/handlers/activitypub-http-fetcher.ts | 6 | ||||
-rw-r--r-- | server/lib/job-queue/handlers/activitypub-refresher.ts | 2 |
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 @@ | |||
1 | import { Job } from 'bull' | 1 | import { Job } from 'bull' |
2 | import { ActivitypubHttpFetcherPayload, FetchType } from '@shared/models' | 2 | import { ActivitypubHttpFetcherPayload, FetchType } from '@shared/models' |
3 | import { logger } from '../../../helpers/logger' | 3 | import { logger } from '../../../helpers/logger' |
4 | import { AccountVideoRateModel } from '../../../models/account/account-video-rate' | ||
5 | import { VideoModel } from '../../../models/video/video' | 4 | import { VideoModel } from '../../../models/video/video' |
6 | import { VideoCommentModel } from '../../../models/video/video-comment' | 5 | import { VideoCommentModel } from '../../../models/video/video-comment' |
7 | import { VideoShareModel } from '../../../models/video/video-share' | 6 | import { VideoShareModel } from '../../../models/video/video-share' |
@@ -11,7 +10,6 @@ import { createAccountPlaylists } from '../../activitypub/playlists' | |||
11 | import { processActivities } from '../../activitypub/process' | 10 | import { processActivities } from '../../activitypub/process' |
12 | import { addVideoShares } from '../../activitypub/share' | 11 | import { addVideoShares } from '../../activitypub/share' |
13 | import { addVideoComments } from '../../activitypub/video-comments' | 12 | import { addVideoComments } from '../../activitypub/video-comments' |
14 | import { createRates } from '../../activitypub/video-rates' | ||
15 | 13 | ||
16 | async function processActivityPubHttpFetcher (job: Job) { | 14 | async 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 | ||
29 | async function refreshVideo (videoUrl: string) { | 29 | async 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) { |