|
|
|
@ -89,6 +89,7 @@ public final class ClosedGroupPoller : NSObject {
|
|
|
|
|
SNLog("Next poll interval for closed group with public key: \(groupPublicKey) is \(nextPollInterval) s.")
|
|
|
|
|
timers[groupPublicKey] = Timer.scheduledTimer(withTimeInterval: nextPollInterval, repeats: false) { [weak self] timer in
|
|
|
|
|
timer.invalidate()
|
|
|
|
|
Threading.closedGroupPollerQueue.async {
|
|
|
|
|
self?.poll(groupPublicKey).done2 { _ in
|
|
|
|
|
DispatchQueue.main.async { // Timers don't do well on background queues
|
|
|
|
|
self?.pollRecursively(groupPublicKey)
|
|
|
|
@ -101,6 +102,7 @@ public final class ClosedGroupPoller : NSObject {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private func poll(_ groupPublicKey: String) -> Promise<Void> {
|
|
|
|
|
guard isPolling(for: groupPublicKey) else { return Promise.value(()) }
|
|
|
|
|