2021-08-27 14:32:44 +02:00
|
|
|
import { Job } from 'bull'
|
2021-06-03 16:02:29 +02:00
|
|
|
import { generateAndSaveActorKeys } from '@server/lib/activitypub/actors'
|
2021-05-11 11:15:29 +02:00
|
|
|
import { ActorModel } from '@server/models/actor/actor'
|
2021-02-26 14:22:25 +01:00
|
|
|
import { ActorKeysPayload } from '@shared/models'
|
|
|
|
import { logger } from '../../../helpers/logger'
|
|
|
|
|
2021-08-27 14:32:44 +02:00
|
|
|
async function processActorKeys (job: Job) {
|
2021-02-26 14:22:25 +01:00
|
|
|
const payload = job.data as ActorKeysPayload
|
2021-02-26 16:26:27 +01:00
|
|
|
logger.info('Processing actor keys in job %d.', job.id)
|
2021-02-26 14:22:25 +01:00
|
|
|
|
|
|
|
const actor = await ActorModel.load(payload.actorId)
|
|
|
|
|
|
|
|
await generateAndSaveActorKeys(actor)
|
|
|
|
}
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
export {
|
|
|
|
processActorKeys
|
|
|
|
}
|