mirror of
https://github.com/oxen-io/session-android.git
synced 2025-06-09 03:58:33 +00:00
clean
This commit is contained in:
parent
a37039cebf
commit
9e025f1b9d
@ -66,9 +66,9 @@ class Poller(private val configFactory: ConfigFactoryProtocol, debounceTimer: Ti
|
||||
Log.d("Loki", "Retrieving user profile.")
|
||||
SnodeAPI.getSwarm(userPublicKey).bind {
|
||||
usedSnodes.clear()
|
||||
val deferred = deferred<Unit, Exception>()
|
||||
pollNextSnode(userProfileOnly = true, deferred)
|
||||
deferred.promise
|
||||
deferred<Unit, Exception>().also {
|
||||
pollNextSnode(userProfileOnly = true, it)
|
||||
}.promise
|
||||
}
|
||||
}
|
||||
// endregion
|
||||
@ -185,8 +185,7 @@ class Poller(private val configFactory: ConfigFactoryProtocol, debounceTimer: Ti
|
||||
return poll(snode, deferred)
|
||||
}
|
||||
|
||||
private fun pollUserProfile(snode: Snode, deferred: Deferred<Unit, Exception>): Promise<Unit, Exception> {
|
||||
return task {
|
||||
private fun pollUserProfile(snode: Snode, deferred: Deferred<Unit, Exception>): Promise<Unit, Exception> = task {
|
||||
runBlocking(Dispatchers.IO) {
|
||||
val requests = mutableListOf<SnodeAPI.SnodeBatchRequestInfo>()
|
||||
val hashesToExtend = mutableSetOf<String>()
|
||||
@ -212,6 +211,7 @@ class Poller(private val configFactory: ConfigFactoryProtocol, debounceTimer: Ti
|
||||
}
|
||||
}
|
||||
|
||||
if (requests.isNotEmpty()) {
|
||||
SnodeAPI.getRawBatchResponse(snode, userPublicKey, requests).bind { rawResponses ->
|
||||
isCaughtUp = true
|
||||
if (deferred.promise.isDone()) {
|
||||
@ -277,6 +277,7 @@ class Poller(private val configFactory: ConfigFactoryProtocol, debounceTimer: Ti
|
||||
}
|
||||
}
|
||||
|
||||
if (requests.isNotEmpty()) {
|
||||
SnodeAPI.getRawBatchResponse(snode, userPublicKey, requests).bind { rawResponses ->
|
||||
isCaughtUp = true
|
||||
if (deferred.promise.isDone()) {
|
||||
@ -346,5 +347,6 @@ class Poller(private val configFactory: ConfigFactoryProtocol, debounceTimer: Ti
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// endregion
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user