mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
minor fix on poller threading
This commit is contained in:
parent
5954c109a1
commit
cd97b9c3e8
1 changed files with 5 additions and 3 deletions
|
@ -71,16 +71,18 @@ public final class Poller : NSObject {
|
|||
// randomElement() uses the system's default random generator, which is cryptographically secure
|
||||
let nextSnode = unusedSnodes.randomElement()!
|
||||
usedSnodes.insert(nextSnode)
|
||||
poll(nextSnode, seal: seal).done(on: Threading.pollerQueue) {
|
||||
poll(nextSnode, seal: seal).done2 {
|
||||
seal.fulfill(())
|
||||
}.catch(on: Threading.pollerQueue) { [weak self] error in
|
||||
}.catch2 { [weak self] error in
|
||||
if let error = error as? Error, error == .pollLimitReached {
|
||||
self?.pollCount = 0
|
||||
} else {
|
||||
SNLog("Polling \(nextSnode) failed; dropping it and switching to next snode.")
|
||||
SnodeAPI.dropSnodeFromSwarmIfNeeded(nextSnode, publicKey: userPublicKey)
|
||||
}
|
||||
self?.pollNextSnode(seal: seal)
|
||||
Threading.pollerQueue.async {
|
||||
self?.pollNextSnode(seal: seal)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
seal.fulfill(())
|
||||
|
|
Loading…
Reference in a new issue