Skip to content
Snippets Groups Projects
Verified Commit 8fd75e35 authored by Janne Mareike Koschinski's avatar Janne Mareike Koschinski
Browse files

Fuck it, just work around the deep sleep stuff

parent 95b8f07d
No related branches found
No related tags found
No related merge requests found
Pipeline #243 passed
......@@ -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
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment