Skip to content

Commit

Permalink
Avoid races between enabling the send queue and receiving back a stat…
Browse files Browse the repository at this point in the history
…us update, stop dropping duplicates both here and on reachability status printing.
  • Loading branch information
stefanceriu committed Jun 21, 2024
1 parent bdaa50c commit 341b6df
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
1 change: 0 additions & 1 deletion ElementX/Sources/Application/AppCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,6 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg
let reachabilityNotificationIdentifier = "io.element.elementx.reachability.notification"
ServiceLocator.shared.networkMonitor
.reachabilityPublisher
.removeDuplicates()
.sink { reachability in
MXLog.info("Reachability changed to \(reachability)")

Expand Down
3 changes: 1 addition & 2 deletions ElementX/Sources/Services/Client/ClientProxy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,10 @@ class ClientProxy: ClientProxyProtocol {
})

sendQueueStatusSubject
.removeDuplicates()
.combineLatest(networkMonitor.reachabilityPublisher)
.debounce(for: 1.0, scheduler: DispatchQueue.main)
.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 {
MXLog.info("Enabling all send queues")
Expand Down

0 comments on commit 341b6df

Please sign in to comment.