Rewrite nasty code with if without else in elvis RHS

This commit is contained in:
Mikhail Glukhikh
2021-02-10 12:08:02 +03:00
parent 7a9315e6b6
commit a88b82d8ff
@@ -56,10 +56,12 @@ class CompileServiceClientSideImpl(
while (keepAliveSuccess()) {
delay(KEEPALIVE_PERIOD - millisecondsSinceLastUsed())
}
runWithTimeout(timeout = KEEPALIVE_PERIOD / 2) {
val keepAliveAcknowledgement = runWithTimeout(timeout = KEEPALIVE_PERIOD / 2) {
val id = sendMessage(keepAliveMessage)
readMessage<Server.KeepAliveAcknowledgement<*>>(id)
} ?: if (!keepAliveSuccess()) readActor.send(StopAllRequests()).also {
}
if (keepAliveAcknowledgement == null && !keepAliveSuccess()) {
readActor.send(StopAllRequests())
}
}
}