Avoid races between enabling the send queue and receiving back a status update, stop dropping duplicates both here and on reachability status printing.

This commit is contained in:
Stefan Ceriu
2024-06-20 14:59:13 +03:00
committed by Stefan Ceriu
parent bdaa50c28c
commit 341b6df70a
2 changed files with 1 additions and 3 deletions
@@ -665,7 +665,6 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg
let reachabilityNotificationIdentifier = "io.element.elementx.reachability.notification" let reachabilityNotificationIdentifier = "io.element.elementx.reachability.notification"
ServiceLocator.shared.networkMonitor ServiceLocator.shared.networkMonitor
.reachabilityPublisher .reachabilityPublisher
.removeDuplicates()
.sink { reachability in .sink { reachability in
MXLog.info("Reachability changed to \(reachability)") MXLog.info("Reachability changed to \(reachability)")
@@ -173,11 +173,10 @@ class ClientProxy: ClientProxyProtocol {
}) })
sendQueueStatusSubject sendQueueStatusSubject
.removeDuplicates()
.combineLatest(networkMonitor.reachabilityPublisher) .combineLatest(networkMonitor.reachabilityPublisher)
.debounce(for: 1.0, scheduler: DispatchQueue.main) .debounce(for: 1.0, scheduler: DispatchQueue.main)
.sink { enabled, reachability in .sink { enabled, reachability in
MXLog.info("Send queue status changed to enabled: \(enabled)") MXLog.info("Send queue status changed to enabled: \(enabled), reachability: \(reachability)")
if enabled == false, reachability == .reachable { if enabled == false, reachability == .reachable {
MXLog.info("Enabling all send queues") MXLog.info("Enabling all send queues")