refactor(core, veranstaltung): Exception-Handling vereinfacht und Delay-Angabe optimiert
Signed-off-by: Stefan Mogeritsch <stefan.mo.co@gmail.com>
This commit is contained in:
+3
-2
@@ -9,6 +9,7 @@ import kotlinx.coroutines.flow.asStateFlow
|
||||
import org.koin.core.component.KoinComponent
|
||||
import org.koin.core.component.inject
|
||||
import org.koin.core.qualifier.named
|
||||
import kotlin.time.Duration.Companion.milliseconds
|
||||
|
||||
/**
|
||||
* Überwacht die Konnektivität zum API-Gateway.
|
||||
@@ -28,7 +29,7 @@ class ConnectivityTracker : KoinComponent {
|
||||
scope.launch {
|
||||
while (isActive) {
|
||||
_isOnline.value = checkConnection()
|
||||
delay(10_000) // Alle 10 Sekunden prüfen
|
||||
delay(10_000.milliseconds) // Alle 10 Sekunden prüfen
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -37,7 +38,7 @@ class ConnectivityTracker : KoinComponent {
|
||||
return try {
|
||||
val response = client.get(NetworkConfig.baseUrl.trimEnd('/') + "/api/ping/health")
|
||||
response.status.value in 200..299
|
||||
} catch (e: Exception) {
|
||||
} catch (_: Exception) {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user