Apply suggestions from code review

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
usbharu 2023-11-27 15:10:22 +09:00 committed by GitHub
parent e40e2c0d96
commit c0dffe7c98
7 changed files with 9 additions and 8 deletions

View File

@ -29,7 +29,6 @@ class APReceiveFollowJobProcessor(
val person = apUserService.fetchPerson(param.actor, param.targetActor) val person = apUserService.fetchPerson(param.actor, param.targetActor)
val follow = objectMapper.readValue<Follow>(param.follow) val follow = objectMapper.readValue<Follow>(param.follow)
logger.info("START Follow from: {} to {}", param.targetActor, param.actor) logger.info("START Follow from: {} to {}", param.targetActor, param.actor)
val signer = userQueryService.findByUrl(param.targetActor) val signer = userQueryService.findByUrl(param.targetActor)

View File

@ -21,7 +21,6 @@ class ApRemoveReactionJobProcessor(
private val applicationConfig: ApplicationConfig private val applicationConfig: ApplicationConfig
) : JobProcessor<DeliverRemoveReactionJobParam, DeliverRemoveReactionJob> { ) : JobProcessor<DeliverRemoveReactionJobParam, DeliverRemoveReactionJob> {
override suspend fun process(param: DeliverRemoveReactionJobParam): Unit = transaction.transaction { override suspend fun process(param: DeliverRemoveReactionJobParam): Unit = transaction.transaction {
val like = objectMapper.readValue<Like>(param.like) val like = objectMapper.readValue<Like>(param.like)
val signer = userQueryService.findByUrl(param.actor) val signer = userQueryService.findByUrl(param.actor)

View File

@ -30,5 +30,4 @@ abstract class AbstractActivityPubProcessor<T : Object>(
} }
abstract suspend fun internalProcess(activity: ActivityPubProcessContext<T>) abstract suspend fun internalProcess(activity: ActivityPubProcessContext<T>)
} }

View File

@ -35,7 +35,6 @@ class InboxJobProcessor(
private val transaction: Transaction private val transaction: Transaction
) : JobProcessor<InboxJobParam, InboxJob> { ) : JobProcessor<InboxJobParam, InboxJob> {
suspend fun process(props: JobProps<InboxJob>) { suspend fun process(props: JobProps<InboxJob>) {
val type = ActivityType.valueOf(props[InboxJob.type]) val type = ActivityType.valueOf(props[InboxJob.type])
val jsonString = objectMapper.readTree(props[InboxJob.json]) val jsonString = objectMapper.readTree(props[InboxJob.json])
val httpRequestString = props[InboxJob.httpRequest] val httpRequestString = props[InboxJob.httpRequest]

View File

@ -29,7 +29,6 @@ object ReceiveFollowJob : HideoutJob<ReceiveFollowJobParam, ReceiveFollowJob>("R
props[follow] = value.follow props[follow] = value.follow
props[actor] = value.actor props[actor] = value.actor
props[targetActor] = value.targetActor props[targetActor] = value.targetActor
} }
override fun convert(props: JobProps<ReceiveFollowJob>): ReceiveFollowJobParam = ReceiveFollowJobParam( override fun convert(props: JobProps<ReceiveFollowJob>): ReceiveFollowJobParam = ReceiveFollowJobParam(
@ -78,7 +77,9 @@ object DeliverReactionJob : HideoutJob<DeliverReactionJobParam, DeliverReactionJ
val actor: Prop<DeliverReactionJob, String> = string("actor") val actor: Prop<DeliverReactionJob, String> = string("actor")
val inbox: Prop<DeliverReactionJob, String> = string("inbox") val inbox: Prop<DeliverReactionJob, String> = string("inbox")
val id: Prop<DeliverReactionJob, String> = string("id") val id: Prop<DeliverReactionJob, String> = string("id")
override fun convert(value: DeliverReactionJobParam): ScheduleContext<DeliverReactionJob>.(DeliverReactionJob) -> Unit = override fun convert(
value: DeliverReactionJobParam
): ScheduleContext<DeliverReactionJob>.(DeliverReactionJob) -> Unit =
{ {
props[reaction] = value.reaction props[reaction] = value.reaction
props[postUrl] = value.postUrl props[postUrl] = value.postUrl

View File

@ -24,7 +24,10 @@ class KJobJobQueueWorkerService(private val jobQueueProcessorList: List<JobProce
}.start() }.start()
} }
override fun <T, R : HideoutJob<T, R>> init(defines: List<Pair<R, JobRegisterContext<R, JobContextWithProps<R>>.(R) -> KJobFunctions<R, JobContextWithProps<R>>>>) { override fun <T, R : HideoutJob<T, R>> init(
defines:
List<Pair<R, JobRegisterContext<R, JobContextWithProps<R>>.(R) -> KJobFunctions<R, JobContextWithProps<R>>>>
) {
defines.forEach { job -> defines.forEach { job ->
kjob.register(job.first, job.second) kjob.register(job.first, job.second)
} }

View File

@ -23,7 +23,8 @@ class KJobMongoJobQueueWorkerService(private val mongoClient: MongoClient) : Job
}.start() }.start()
} }
override fun <T, R : HideoutJob<T, R>> init(defines: List<Pair<R, JobRegisterContext<R, JobContextWithProps<R>>.(R) -> KJobFunctions<R, JobContextWithProps<R>>>>) { override fun <T, R : HideoutJob<T, R>> init(defines:
List<Pair<R, JobRegisterContext<R, JobContextWithProps<R>>.(R) -> KJobFunctions<R, JobContextWithProps<R>>>>) {
defines.forEach { job -> defines.forEach { job ->
kjob.register(job.first, job.second) kjob.register(job.first, job.second)
} }