Fuck it, just work around the deep sleep stuff

parent 95b8f07d
Pipeline #243 passed with stages
in 14 minutes 30 seconds
......@@ -15,16 +15,18 @@ class AndroidHeartBeatRunner(
) : HeartBeatRunner {
private var running = true
private var lastHeartBeatReply: Instant = Instant.now()
private var lastHeartBeatSend: Instant = Instant.now()
override fun start() {
if (running) {
val now = Instant.now()
val duration = Duration.between(lastHeartBeatReply, now).toMillis()
val duration = Duration.between(lastHeartBeatReply, lastHeartBeatSend).toMillis()
if (duration > TIMEOUT) {
log(INFO, "Heartbeat", "Ping Timeout: Last Response ${duration}ms ago")
session.close()
} else {
log(INFO, "Heartbeat", "Sending Heartbeat")
val now = Instant.now()
lastHeartBeatSend = now
session.dispatch(SignalProxyMessage.HeartBeat(now))
}
handler.postDelayed(::start, DELAY)
......@@ -40,7 +42,7 @@ class AndroidHeartBeatRunner(
}
companion object {
const val TIMEOUT = 120_000L
const val TIMEOUT = 90_000L
const val DELAY = 30_000L
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment