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/actor-keys.ts20
-rw-r--r--server/lib/job-queue/job-queue.ts5
2 files changed, 25 insertions, 0 deletions
diff --git a/server/lib/job-queue/handlers/actor-keys.ts b/server/lib/job-queue/handlers/actor-keys.ts
new file mode 100644
index 000000000..8da549640
--- /dev/null
+++ b/server/lib/job-queue/handlers/actor-keys.ts
@@ -0,0 +1,20 @@
1import * as Bull from 'bull'
2import { generateAndSaveActorKeys } from '@server/lib/activitypub/actor'
3import { ActorModel } from '@server/models/activitypub/actor'
4import { ActorKeysPayload } from '@shared/models'
5import { logger } from '../../../helpers/logger'
6
7async function processActorKeys (job: Bull.Job) {
8 const payload = job.data as ActorKeysPayload
9 logger.info('Processing email in job %d.', job.id)
10
11 const actor = await ActorModel.load(payload.actorId)
12
13 await generateAndSaveActorKeys(actor)
14}
15
16// ---------------------------------------------------------------------------
17
18export {
19 processActorKeys
20}
diff --git a/server/lib/job-queue/job-queue.ts b/server/lib/job-queue/job-queue.ts
index 72fed6072..efda2e038 100644
--- a/server/lib/job-queue/job-queue.ts
+++ b/server/lib/job-queue/job-queue.ts
@@ -7,6 +7,7 @@ import {
7 ActivitypubHttpBroadcastPayload, 7 ActivitypubHttpBroadcastPayload,
8 ActivitypubHttpFetcherPayload, 8 ActivitypubHttpFetcherPayload,
9 ActivitypubHttpUnicastPayload, 9 ActivitypubHttpUnicastPayload,
10 ActorKeysPayload,
10 EmailPayload, 11 EmailPayload,
11 JobState, 12 JobState,
12 JobType, 13 JobType,
@@ -25,6 +26,7 @@ import { processActivityPubHttpBroadcast } from './handlers/activitypub-http-bro
25import { processActivityPubHttpFetcher } from './handlers/activitypub-http-fetcher' 26import { processActivityPubHttpFetcher } from './handlers/activitypub-http-fetcher'
26import { processActivityPubHttpUnicast } from './handlers/activitypub-http-unicast' 27import { processActivityPubHttpUnicast } from './handlers/activitypub-http-unicast'
27import { refreshAPObject } from './handlers/activitypub-refresher' 28import { refreshAPObject } from './handlers/activitypub-refresher'
29import { processActorKeys } from './handlers/actor-keys'
28import { processEmail } from './handlers/email' 30import { processEmail } from './handlers/email'
29import { processVideoFileImport } from './handlers/video-file-import' 31import { processVideoFileImport } from './handlers/video-file-import'
30import { processVideoImport } from './handlers/video-import' 32import { processVideoImport } from './handlers/video-import'
@@ -44,6 +46,7 @@ type CreateJobArgument =
44 { type: 'activitypub-refresher', payload: RefreshPayload } | 46 { type: 'activitypub-refresher', payload: RefreshPayload } |
45 { type: 'videos-views', payload: {} } | 47 { type: 'videos-views', payload: {} } |
46 { type: 'video-live-ending', payload: VideoLiveEndingPayload } | 48 { type: 'video-live-ending', payload: VideoLiveEndingPayload } |
49 { type: 'actor-keys', payload: ActorKeysPayload } |
47 { type: 'video-redundancy', payload: VideoRedundancyPayload } 50 { type: 'video-redundancy', payload: VideoRedundancyPayload }
48 51
49type CreateJobOptions = { 52type CreateJobOptions = {
@@ -63,6 +66,7 @@ const handlers: { [id in JobType]: (job: Bull.Job) => Promise<any> } = {
63 'videos-views': processVideosViews, 66 'videos-views': processVideosViews,
64 'activitypub-refresher': refreshAPObject, 67 'activitypub-refresher': refreshAPObject,
65 'video-live-ending': processVideoLiveEnding, 68 'video-live-ending': processVideoLiveEnding,
69 'actor-keys': processActorKeys,
66 'video-redundancy': processVideoRedundancy 70 'video-redundancy': processVideoRedundancy
67} 71}
68 72
@@ -78,6 +82,7 @@ const jobTypes: JobType[] = [
78 'videos-views', 82 'videos-views',
79 'activitypub-refresher', 83 'activitypub-refresher',
80 'video-redundancy', 84 'video-redundancy',
85 'actor-keys',
81 'video-live-ending' 86 'video-live-ending'
82] 87]
83 88