From 910886f8b5fa907021b1e85f415bd96801743e35 Mon Sep 17 00:00:00 2001 From: dalbodeule <11470513+dalbodeule@users.noreply.github.com> Date: Tue, 13 Aug 2024 19:20:16 +0900 Subject: [PATCH] debug some errors. - ChzzkHandler.runStreamInfo debugs with startThread functions. --- .../mori/chzzk_bot/chatbot/chzzk/ChzzkHandler.kt | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/chatbot/src/main/kotlin/space/mori/chzzk_bot/chatbot/chzzk/ChzzkHandler.kt b/chatbot/src/main/kotlin/space/mori/chzzk_bot/chatbot/chzzk/ChzzkHandler.kt index 68710f7..c1432ec 100644 --- a/chatbot/src/main/kotlin/space/mori/chzzk_bot/chatbot/chzzk/ChzzkHandler.kt +++ b/chatbot/src/main/kotlin/space/mori/chzzk_bot/chatbot/chzzk/ChzzkHandler.kt @@ -3,6 +3,7 @@ package space.mori.chzzk_bot.chatbot.chzzk import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.delay +import kotlinx.coroutines.future.await import kotlinx.coroutines.launch import org.koin.java.KoinJavaComponent.inject import org.slf4j.Logger @@ -215,15 +216,15 @@ class UserHandler( internal fun isActive(value: Boolean, status: IData) { if(value) { - logger.info("${user.username} is live.") - - logger.info("ChzzkChat connecting... ${channel.channelName} - ${channel.channelId}") - listener.connectBlocking() - - streamStartTime = status.content?.openDate?.let { convertChzzkDateToLocalDateTime(it) } - CoroutineScope(Dispatchers.Default).launch { if(!_isActive) { + logger.info("${user.username} is live.") + + logger.info("ChzzkChat connecting... ${channel.channelName} - ${channel.channelId}") + listener.connectAsync().await() + + streamStartTime = status.content?.openDate?.let { convertChzzkDateToLocalDateTime(it) } + _isActive = true when(TimerConfigService.getConfig(UserService.getUser(channel.channelId)!!)?.option) { TimerType.UPTIME.value -> dispatcher.post(