fix closed group threading issue
This commit is contained in:
parent
d97f3a4dc9
commit
d6d041a74f
|
@ -5,6 +5,7 @@ import PromiseKit
|
||||||
public final class ClosedGroupPoller : NSObject {
|
public final class ClosedGroupPoller : NSObject {
|
||||||
private var isPolling: [String:Bool] = [:]
|
private var isPolling: [String:Bool] = [:]
|
||||||
private var timers: [String:Timer] = [:]
|
private var timers: [String:Timer] = [:]
|
||||||
|
private let internalQueue: DispatchQueue = DispatchQueue(label:"isPollingQueue")
|
||||||
|
|
||||||
// MARK: Settings
|
// MARK: Settings
|
||||||
private static let minPollInterval: Double = 2
|
private static let minPollInterval: Double = 2
|
||||||
|
@ -137,6 +138,6 @@ public final class ClosedGroupPoller : NSObject {
|
||||||
|
|
||||||
// MARK: Convenience
|
// MARK: Convenience
|
||||||
private func isPolling(for groupPublicKey: String) -> Bool {
|
private func isPolling(for groupPublicKey: String) -> Bool {
|
||||||
return isPolling[groupPublicKey] ?? false
|
return internalQueue.sync{ isPolling[groupPublicKey] ?? false }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue