From 3c91b514890f6ffe23a1cafd0b0f87e6e1893d80 Mon Sep 17 00:00:00 2001 From: eliotcougar Date: Wed, 19 Aug 2026 08:57:06 +0300 Subject: [PATCH] Optimize large-group probing startup (#6102) Clear visible delays immediately, but move the per-profile MMKV reset to the existing I/O coroutine. Finish the reset before starting the test service so newly reported results cannot be erased. --- .../main/java/com/v2ray/ang/ui/main/MainViewModel.kt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/V2rayNG/app/src/main/java/com/v2ray/ang/ui/main/MainViewModel.kt b/V2rayNG/app/src/main/java/com/v2ray/ang/ui/main/MainViewModel.kt index 89b0cf0e..0704f781 100644 --- a/V2rayNG/app/src/main/java/com/v2ray/ang/ui/main/MainViewModel.kt +++ b/V2rayNG/app/src/main/java/com/v2ray/ang/ui/main/MainViewModel.kt @@ -689,11 +689,17 @@ class MainViewModel( dataSource.cancelAllPing() val groupId = uiState.value.selectedGroupId val servers = currentServers() - dataSource.clearAllTestDelayResults(servers.map { it.guid }) if (servers.isEmpty()) { _uiState.update { it.copy(isTesting = false) } return } + val serverGuids = servers.map { it.guid } + mutableServersForGroup(groupId).update { current -> + current.map { server -> + if (server.testDelayMillis == 0L) server + else server.copy(testDelayMillis = 0L) + } + } testingGroupId = groupId _uiState.update { it.copy( @@ -702,12 +708,13 @@ class MainViewModel( ) } viewModelScope.launch(ioDispatcher) { + dataSource.clearAllTestDelayResults(serverGuids) cacheMutex.withLock { groupDataCache.remove(groupId) } dataSource.sendMsg2TestService( TestServiceMessage( key = AppConfig.MSG_MEASURE_CONFIG_START, subscriptionId = groupId, - serverGuids = if (keywordFilter.isNotEmpty()) servers.map { it.guid } else emptyList(), + serverGuids = if (keywordFilter.isNotEmpty()) serverGuids else emptyList(), onlyTcp = onlyTcp ) )