Rename variable SCAN_TIMEOUT to ADV_EXPIRATION_TIME
This commit is contained in:
+2
-3
@@ -37,7 +37,6 @@ import kotlinx.coroutines.withTimeout
|
||||
import kotlinx.coroutines.TimeoutCancellationException
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.map
|
||||
import kotlin.time.Duration.Companion.milliseconds
|
||||
import kotlin.time.Duration.Companion.seconds
|
||||
import kotlin.time.TimeSource
|
||||
import kotlin.uuid.ExperimentalUuidApi
|
||||
@@ -59,7 +58,7 @@ class ScannerViewModel(
|
||||
private val scannerRepository: ScannerRepository
|
||||
) : ViewModel() {
|
||||
companion object {
|
||||
private val SCAN_TIMEOUT = 5.seconds
|
||||
private val ADV_EXPIRATION_TIME = 5.seconds
|
||||
private val CONNECTION_TIMEOUT = 5.seconds
|
||||
private const val MAX_LOG_ENTRIES = 50
|
||||
}
|
||||
@@ -142,7 +141,7 @@ class ScannerViewModel(
|
||||
cleanupJob = viewModelScope.launch {
|
||||
while (advertisementMap.isNotEmpty() && isActive) {
|
||||
delay(5000)
|
||||
val keysToRemove = advertisementMap.filter { it.value.timeMark.elapsedNow() > SCAN_TIMEOUT }.keys
|
||||
val keysToRemove = advertisementMap.filter { it.value.timeMark.elapsedNow() > ADV_EXPIRATION_TIME }.keys
|
||||
if (keysToRemove.isNotEmpty()) {
|
||||
keysToRemove.forEach { advertisementMap.remove(it) }
|
||||
updateDeviceList()
|
||||
|
||||
Reference in New Issue
Block a user