Skip to content

Commit 0586c2c

Browse files
committed
Revert "Attempt to prevent crashes after expiring background refreshes."
This reverts commit 418daaa.
1 parent 51886b0 commit 0586c2c

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

ElementX/Sources/Application/AppCoordinator.swift

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -893,11 +893,8 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg
893893
// Attempt to stop the background task sync loop cleanly, only if the app not already running
894894
return
895895
}
896-
897-
MainActor.assumeIsolated {
898-
userSession?.clientProxy.stopSync(completion: completion)
899-
clientProxyObserver = nil
900-
}
896+
userSession?.clientProxy.stopSync(completion: completion)
897+
clientProxyObserver = nil
901898
}
902899

903900
private func startSync() {
@@ -1039,13 +1036,7 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg
10391036
// This is important for the app to keep refreshing in the background
10401037
scheduleBackgroundAppRefresh()
10411038

1042-
/// We have a lot of crashes stemming here which we previously believed are caused by stopSync not being async
1043-
/// on the client proxy side (see the comment on that method). We have now realised that will likely not fix anything but
1044-
/// we also noticed this does not crash on the main thread, even though the whole AppCoordinator is on the Main actor.
1045-
/// As such, we introduced a MainActor conformance on the expirationHandler but we are also assuming main actor
1046-
/// isolated in the `stopSync` method above.
1047-
/// https://sentry.tools.element.io/organizations/element/issues/4477794/
1048-
task.expirationHandler = { @MainActor [weak self] in
1039+
task.expirationHandler = { [weak self] in
10491040
MXLog.info("Background app refresh task is about to expire.")
10501041

10511042
self?.stopSync(isBackgroundTask: true) {

0 commit comments

Comments
 (0)