mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Undo hack
This commit is contained in:
parent
cba3d2d55b
commit
f1ec7e67b1
|
@ -114,13 +114,13 @@ public extension LokiAPI {
|
|||
}
|
||||
}
|
||||
|
||||
internal static func getSwarm(for hexEncodedPublicKey: String) -> Promise<[LokiAPITarget]> {
|
||||
internal static func getSwarm(for hexEncodedPublicKey: String, isForcedReload: Bool = false) -> Promise<[LokiAPITarget]> {
|
||||
if swarmCache[hexEncodedPublicKey] == nil {
|
||||
storage.dbReadConnection.read { transaction in
|
||||
swarmCache[hexEncodedPublicKey] = storage.getSwarm(for: hexEncodedPublicKey, in: transaction)
|
||||
}
|
||||
}
|
||||
if let cachedSwarm = swarmCache[hexEncodedPublicKey], cachedSwarm.count >= minimumSwarmSnodeCount {
|
||||
if let cachedSwarm = swarmCache[hexEncodedPublicKey], cachedSwarm.count >= minimumSwarmSnodeCount && !isForcedReload {
|
||||
return Promise<[LokiAPITarget]> { $0.fulfill(cachedSwarm) }
|
||||
} else {
|
||||
print("[Loki] Getting swarm for: \(hexEncodedPublicKey).")
|
||||
|
|
|
@ -54,7 +54,7 @@ public final class LokiPoller : NSObject {
|
|||
// MARK: Private API
|
||||
private func setUpPolling() {
|
||||
guard !hasStopped else { return }
|
||||
LokiAPI.getSwarm(for: getUserHexEncodedPublicKey()).then2 { [weak self] _ -> Promise<Void> in
|
||||
LokiAPI.getSwarm(for: getUserHexEncodedPublicKey(), isForcedReload: true).then2 { [weak self] _ -> Promise<Void> in
|
||||
guard let strongSelf = self else { return Promise { $0.fulfill(()) } }
|
||||
strongSelf.usedSnodes.removeAll()
|
||||
let (promise, seal) = Promise<Void>.pending()
|
||||
|
|
|
@ -73,9 +73,6 @@ public class MessageSenderJobQueue: NSObject, JobQueue {
|
|||
return
|
||||
}
|
||||
self.add(jobRecord: jobRecord, transaction: transaction)
|
||||
transaction.addCompletionQueue(DispatchQueue.global()) {
|
||||
self.workStep() // Loki: Hack to make message sending faster until we have decentralized multi device and no more proof of work
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: JobQueue
|
||||
|
|
Loading…
Reference in a new issue