mirror of
https://github.com/MatsuriDayo/NekoBoxForAndroid.git
synced 2025-12-19 14:40:06 +08:00
add testPool for urltest
This commit is contained in:
parent
bb575e92cf
commit
25fe0227c8
@ -626,7 +626,7 @@ class ConfigurationFragment @JvmOverloads constructor(
|
|||||||
val profiles = ConcurrentLinkedQueue(profilesUnfiltered)
|
val profiles = ConcurrentLinkedQueue(profilesUnfiltered)
|
||||||
val testPool = newFixedThreadPoolContext(
|
val testPool = newFixedThreadPoolContext(
|
||||||
DataStore.connectionTestConcurrent,
|
DataStore.connectionTestConcurrent,
|
||||||
"Connection test pool"
|
"pingTest"
|
||||||
)
|
)
|
||||||
repeat(DataStore.connectionTestConcurrent) {
|
repeat(DataStore.connectionTestConcurrent) {
|
||||||
testJobs.add(launch(testPool) {
|
testJobs.add(launch(testPool) {
|
||||||
@ -750,6 +750,7 @@ class ConfigurationFragment @JvmOverloads constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(DelicateCoroutinesApi::class)
|
||||||
fun urlTest() {
|
fun urlTest() {
|
||||||
val test = TestDialog()
|
val test = TestDialog()
|
||||||
val dialog = test.builder.show()
|
val dialog = test.builder.show()
|
||||||
@ -764,10 +765,13 @@ class ConfigurationFragment @JvmOverloads constructor(
|
|||||||
val profilesUnfiltered = SagerDatabase.proxyDao.getByGroup(group.id)
|
val profilesUnfiltered = SagerDatabase.proxyDao.getByGroup(group.id)
|
||||||
test.proxyN = profilesUnfiltered.size
|
test.proxyN = profilesUnfiltered.size
|
||||||
val profiles = ConcurrentLinkedQueue(profilesUnfiltered)
|
val profiles = ConcurrentLinkedQueue(profilesUnfiltered)
|
||||||
val urlTest = UrlTest() // note: this is NOT in bg process
|
val testPool = newFixedThreadPoolContext(
|
||||||
|
DataStore.connectionTestConcurrent,
|
||||||
|
"urlTest"
|
||||||
|
)
|
||||||
repeat(DataStore.connectionTestConcurrent) {
|
repeat(DataStore.connectionTestConcurrent) {
|
||||||
testJobs.add(launch {
|
testJobs.add(launch(testPool) {
|
||||||
|
val urlTest = UrlTest() // note: this is NOT in bg process
|
||||||
while (isActive) {
|
while (isActive) {
|
||||||
val profile = profiles.poll() ?: break
|
val profile = profiles.poll() ?: break
|
||||||
profile.status = 0
|
profile.status = 0
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user