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