diff --git a/SessionMessagingKit/Sending & Receiving/Pollers/ClosedGroupPoller.swift b/SessionMessagingKit/Sending & Receiving/Pollers/ClosedGroupPoller.swift index 00148075a..1142ff4d8 100644 --- a/SessionMessagingKit/Sending & Receiving/Pollers/ClosedGroupPoller.swift +++ b/SessionMessagingKit/Sending & Receiving/Pollers/ClosedGroupPoller.swift @@ -44,7 +44,7 @@ public final class ClosedGroupPoller : NSObject { // Might be a race condition that the setUpPolling finishes too soon, // and the timer is not created, if we mark the group as is polling // after setUpPolling. So the poller may not work, thus misses messages. - isPolling[groupPublicKey] = true + internalQueue.sync{ isPolling[groupPublicKey] = true } setUpPolling(for: groupPublicKey) } @@ -55,7 +55,7 @@ public final class ClosedGroupPoller : NSObject { } public func stopPolling(for groupPublicKey: String) { - isPolling[groupPublicKey] = false + internalQueue.sync{ isPolling[groupPublicKey] = false } timers[groupPublicKey]?.invalidate() }