Add a 5s timeout to avoid infinite loading (actually waiting for network timeout which can be long and is harder to configure).
This commit is contained in:
parent
25eb3a556b
commit
168f5dfa89
1 changed files with 6 additions and 1 deletions
|
|
@ -30,6 +30,7 @@ import kotlinx.coroutines.delay
|
|||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.flow
|
||||
import kotlinx.coroutines.withContext
|
||||
import kotlinx.coroutines.withTimeout
|
||||
import java.util.Collections
|
||||
import javax.inject.Inject
|
||||
|
||||
|
|
@ -56,7 +57,11 @@ class HomeserverResolver @Inject constructor(
|
|||
withContext(dispatchers.io) {
|
||||
list.map {
|
||||
async {
|
||||
val wellKnown = tryOrNull { wellknownRequest.execute(it) }
|
||||
val wellKnown = tryOrNull {
|
||||
withTimeout(5000) {
|
||||
wellknownRequest.execute(it)
|
||||
}
|
||||
}
|
||||
val isValid = wellKnown?.isValid().orFalse()
|
||||
if (isValid) {
|
||||
val supportSlidingSync = wellKnown?.supportSlidingSync().orFalse()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue