1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2025-09-03 07:09:23 +00:00

small improvements in long polling and behaviour buildr

This commit is contained in:
2025-06-15 11:38:17 +06:00
parent d19e6ad4e0
commit 429fc5d2f9
13 changed files with 75 additions and 49 deletions

View File

@@ -217,7 +217,7 @@ fun <T, BC : BehaviourContext> BC.launchInNewSubContext(
updatesUpstreamFlow = updatesUpstreamFlow,
subcontextInitialAction = subcontextInitialAction
).apply {
this@apply.launchLoggingDropExceptions(logger = Log ?: KSLog) {
this@apply.launchLoggingDropExceptions(logger = Log) {
behaviourContextReceiver()
}
}.coroutineContext.job

View File

@@ -40,7 +40,7 @@ class CombinedSubcontextInitialAction(
runCatching {
invoke(update)
}.onFailure {
(Log ?: logger).error(it) {
Log.error(it) {
"Unable to execute $subaction for update $update. Will try on next round"
}
}.onSuccess {
@@ -50,7 +50,7 @@ class CombinedSubcontextInitialAction(
}
leftSubActions.removeAll(successSubActions)
if (successSubActions.isEmpty()) {
(Log ?: logger).error {
Log.error {
"Some SubActions have been unable to complete successfully:${leftSubActions.joinToString("\n") { it.toString() }}"
}
break