Skip to content

Commit

Permalink
try to fix bug, where too many commands can block appservice
Browse files Browse the repository at this point in the history
  • Loading branch information
benkuly committed Jun 14, 2020
1 parent d1c65ff commit fd5621d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 24 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ allprojects {
apply(plugin = "kotlin")

group = "net.folivo"
version = "0.2.3.RELEASE"
version = "0.2.4.RELEASE"
java.sourceCompatibility = JavaVersion.VERSION_11

repositories {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,29 +40,28 @@ class SmsBotMessageHandler(
val args = Commandline.translateCommandline(body.removePrefix("sms"))

//TODO test
Mono.empty<Void>()
.publishOn(Schedulers.boundedElastic())
.then(Mono.from<Void> { subscriber ->
val answerConsole = SmsBotConsole(context)
try {
SmsCommand().context { console = answerConsole }
.subcommands(SendSmsCommand(sender, helper, smsBridgeProperties))
.parse(args)
} catch (e: PrintHelpMessage) {
answerConsole.print(e.command.getFormattedHelp(), false)
} catch (e: PrintCompletionMessage) {
e.message?.also { answerConsole.print(it, false) }
} catch (e: PrintMessage) {
e.message?.also { answerConsole.print(it, false) }
} catch (e: UsageError) {
answerConsole.print(e.helpMessage(), true)
} catch (e: CliktError) {
e.message?.also { answerConsole.print(it, true) }
} catch (e: Abort) {
answerConsole.print("Aborted!", true)
}
subscriber.onComplete()
}).thenReturn(true)
Mono.from<Void> { subscriber ->
val answerConsole = SmsBotConsole(context)
try {
SmsCommand().context { console = answerConsole }
.subcommands(SendSmsCommand(sender, helper, smsBridgeProperties))
.parse(args)
} catch (e: PrintHelpMessage) {
answerConsole.print(e.command.getFormattedHelp(), false)
} catch (e: PrintCompletionMessage) {
e.message?.also { answerConsole.print(it, false) }
} catch (e: PrintMessage) {
e.message?.also { answerConsole.print(it, false) }
} catch (e: UsageError) {
answerConsole.print(e.helpMessage(), true)
} catch (e: CliktError) {
e.message?.also { answerConsole.print(it, true) }
} catch (e: Abort) {
answerConsole.print("Aborted!", true)
}
subscriber.onComplete()
}.subscribeOn(Schedulers.boundedElastic())
.thenReturn(true)
}
} else if (room.members.size == 2) {
LOG.debug("it seems to be a bot room, but message didn't start with 'sms'")
Expand Down

0 comments on commit fd5621d

Please sign in to comment.