diff --git a/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubNoteServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubNoteServiceImpl.kt index e9a9f1d9..f5a76bb3 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubNoteServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubNoteServiceImpl.kt @@ -10,6 +10,7 @@ import dev.usbharu.hideout.service.impl.UserService import dev.usbharu.hideout.service.job.JobQueueParentService import io.ktor.client.* import kjob.core.job.JobProps +import org.slf4j.LoggerFactory class ActivityPubNoteServiceImpl( private val httpClient: HttpClient, @@ -17,6 +18,8 @@ class ActivityPubNoteServiceImpl( private val userService: UserService ) : ActivityPubNoteService { + private val logger = LoggerFactory.getLogger(this::class.java) + override suspend fun createNote(post: PostEntity) { val followers = userService.findFollowersById(post.userId) val userEntity = userService.findById(post.userId) @@ -35,6 +38,7 @@ class ActivityPubNoteServiceImpl( val actor = props[DeliverPostJob.actor] val note = Config.configData.objectMapper.readValue(props[DeliverPostJob.post]) val inbox = props[DeliverPostJob.inbox] + logger.debug("createNoteJob: actor={}, note={}, inbox={}", actor, note, inbox) httpClient.postAp( urlString = inbox, username = "$actor#pubkey", diff --git a/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubServiceImpl.kt index 7fffacb8..e86f967f 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubServiceImpl.kt @@ -74,6 +74,7 @@ class ActivityPubServiceImpl( } override suspend fun processActivity(job: JobContextWithProps, hideoutJob: HideoutJob) { + logger.debug("processActivity: ${hideoutJob.name}") when (hideoutJob) { ReceiveFollowJob -> activityPubFollowService.receiveFollowJob(job.props as JobProps) DeliverPostJob -> activityPubNoteService.createNoteJob(job.props as JobProps) diff --git a/src/main/kotlin/dev/usbharu/hideout/service/job/KJobJobQueueParentService.kt b/src/main/kotlin/dev/usbharu/hideout/service/job/KJobJobQueueParentService.kt index 1f4178b5..6324fde7 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/job/KJobJobQueueParentService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/job/KJobJobQueueParentService.kt @@ -6,9 +6,12 @@ import kjob.core.KJob import kjob.core.dsl.ScheduleContext import kjob.core.kjob import org.jetbrains.exposed.sql.Database +import org.slf4j.LoggerFactory class KJobJobQueueParentService(private val database: Database) : JobQueueParentService { + private val logger = LoggerFactory.getLogger(this::class.java) + val kjob: KJob = kjob(ExposedKJob) { connectionDatabase = database isWorker = false @@ -19,6 +22,7 @@ class KJobJobQueueParentService(private val database: Database) : JobQueueParent } override suspend fun schedule(job: J,block:ScheduleContext.(J)->Unit) { + logger.debug("schedule job={}",job.name) kjob.schedule(job,block) } }