Compare commits

..
1 Commits
Author SHA1 Message Date
admin 5555676395 Shorten driver Reverb heartbeat 2026-07-02 16:08:24 +02:00
2 changed files with 7 additions and 3 deletions
+2 -2
View File
@@ -33,8 +33,8 @@ android {
applicationId = "pl.firmatpp.kierowca" applicationId = "pl.firmatpp.kierowca"
minSdk = 26 minSdk = 26
targetSdk = 35 targetSdk = 35
versionCode = 34 versionCode = 35
versionName = "1.0.33" versionName = "1.0.34"
setProperty("archivesBaseName", "pl.firmatpp.kierowca") setProperty("archivesBaseName", "pl.firmatpp.kierowca")
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
@@ -25,6 +25,10 @@ class DriverLiveSyncClient(
private val client: OkHttpClient = OkHttpClient(), private val client: OkHttpClient = OkHttpClient(),
private val gson: Gson = Gson(), private val gson: Gson = Gson(),
) { ) {
private companion object {
const val HEARTBEAT_INTERVAL_MS = 10_000L
}
private val scope = CoroutineScope(SupervisorJob() + Dispatchers.IO) private val scope = CoroutineScope(SupervisorJob() + Dispatchers.IO)
private val started = AtomicBoolean(false) private val started = AtomicBoolean(false)
private var webSocket: WebSocket? = null private var webSocket: WebSocket? = null
@@ -162,7 +166,7 @@ class DriverLiveSyncClient(
heartbeatJob = scope.launch { heartbeatJob = scope.launch {
while (started.get()) { while (started.get()) {
reportRealtimeStatus("connected") reportRealtimeStatus("connected")
delay(30_000) delay(HEARTBEAT_INTERVAL_MS)
} }
} }
} }