Shorten driver Reverb heartbeat
This commit is contained in:
@@ -33,8 +33,8 @@ android {
|
||||
applicationId = "pl.firmatpp.kierowca"
|
||||
minSdk = 26
|
||||
targetSdk = 35
|
||||
versionCode = 34
|
||||
versionName = "1.0.33"
|
||||
versionCode = 35
|
||||
versionName = "1.0.34"
|
||||
setProperty("archivesBaseName", "pl.firmatpp.kierowca")
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
|
||||
@@ -25,6 +25,10 @@ class DriverLiveSyncClient(
|
||||
private val client: OkHttpClient = OkHttpClient(),
|
||||
private val gson: Gson = Gson(),
|
||||
) {
|
||||
private companion object {
|
||||
const val HEARTBEAT_INTERVAL_MS = 10_000L
|
||||
}
|
||||
|
||||
private val scope = CoroutineScope(SupervisorJob() + Dispatchers.IO)
|
||||
private val started = AtomicBoolean(false)
|
||||
private var webSocket: WebSocket? = null
|
||||
@@ -162,7 +166,7 @@ class DriverLiveSyncClient(
|
||||
heartbeatJob = scope.launch {
|
||||
while (started.get()) {
|
||||
reportRealtimeStatus("connected")
|
||||
delay(30_000)
|
||||
delay(HEARTBEAT_INTERVAL_MS)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user