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( ...@@ -15,16 +15,18 @@ class AndroidHeartBeatRunner(
) : HeartBeatRunner { ) : HeartBeatRunner {
private var running = true private var running = true
private var lastHeartBeatReply: Instant = Instant.now() private var lastHeartBeatReply: Instant = Instant.now()
private var lastHeartBeatSend: Instant = Instant.now()
override fun start() { override fun start() {
if (running) { if (running) {
val now = Instant.now() val duration = Duration.between(lastHeartBeatReply, lastHeartBeatSend).toMillis()
val duration = Duration.between(lastHeartBeatReply, now).toMillis()
if (duration > TIMEOUT) { if (duration > TIMEOUT) {
log(INFO, "Heartbeat", "Ping Timeout: Last Response ${duration}ms ago") log(INFO, "Heartbeat", "Ping Timeout: Last Response ${duration}ms ago")
session.close() session.close()
} else { } else {
log(INFO, "Heartbeat", "Sending Heartbeat") log(INFO, "Heartbeat", "Sending Heartbeat")
val now = Instant.now()
lastHeartBeatSend = now
session.dispatch(SignalProxyMessage.HeartBeat(now)) session.dispatch(SignalProxyMessage.HeartBeat(now))
} }
handler.postDelayed(::start, DELAY) handler.postDelayed(::start, DELAY)
...@@ -40,7 +42,7 @@ class AndroidHeartBeatRunner( ...@@ -40,7 +42,7 @@ class AndroidHeartBeatRunner(
} }
companion object { companion object {
const val TIMEOUT = 120_000L const val TIMEOUT = 90_000L
const val DELAY = 30_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