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