fix(tui): run WS collectors on IO dispatcher so they aren't starved by runner.run
This commit is contained in:
@@ -63,12 +63,12 @@ fun main(args: Array<String>) {
|
||||
}
|
||||
}
|
||||
|
||||
launch {
|
||||
effectScope.launch {
|
||||
ws.messages.collect { msg ->
|
||||
runner.runOnRenderThread { dispatch(Action.ServerEventReceived(msg)) }
|
||||
}
|
||||
}
|
||||
launch {
|
||||
effectScope.launch {
|
||||
ws.connection.collect { ev ->
|
||||
val action = when (ev) {
|
||||
is ConnectionEvent.Connected -> Action.Connected
|
||||
@@ -78,7 +78,7 @@ fun main(args: Array<String>) {
|
||||
runner.runOnRenderThread { dispatch(action) }
|
||||
}
|
||||
}
|
||||
launch { ws.connect() }
|
||||
effectScope.launch { ws.connect() }
|
||||
|
||||
val handler = EventHandler { event, _ ->
|
||||
if (event is TambouiKeyEvent) {
|
||||
|
||||
Reference in New Issue
Block a user