Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove 10s wait on failed initial sync #7068

Merged
merged 1 commit into from
Nov 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 2 additions & 13 deletions Riot/Modules/MatrixKit/Models/Account/MXKAccount.m
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ @interface MXKAccount ()
// We will notify user only once on session failure
BOOL notifyOpenSessionFailure;

// The timer used to postpone server sync on failure
NSTimer* initialServerSyncTimer;

// Reachability observer
id reachabilityObserver;

Expand Down Expand Up @@ -934,9 +931,6 @@ - (void)closeSession:(BOOL)clearStore
sessionStateObserver = nil;
}

[initialServerSyncTimer invalidate];
initialServerSyncTimer = nil;

if (userUpdateListener)
{
[mxSession.myUser removeListener:userUpdateListener];
Expand Down Expand Up @@ -1136,8 +1130,6 @@ - (void)pauseInBackgroundTask
// Cancel pending actions
[[NSNotificationCenter defaultCenter] removeObserver:reachabilityObserver];
reachabilityObserver = nil;
[initialServerSyncTimer invalidate];
initialServerSyncTimer = nil;

MXLogDebug(@"[MXKAccount] Pause is delayed due to the session state: %@", [MXTools readableSessionState: mxSession.state]);
}
Expand Down Expand Up @@ -1627,8 +1619,6 @@ - (void)launchInitialServerSync
// Cancel potential reachability observer and pending action
[[NSNotificationCenter defaultCenter] removeObserver:reachabilityObserver];
reachabilityObserver = nil;
[initialServerSyncTimer invalidate];
initialServerSyncTimer = nil;

// Sanity check
if (!mxSession || (mxSession.state != MXSessionStateStoreDataReady && mxSession.state != MXSessionStateInitialSyncFailed))
Expand Down Expand Up @@ -1694,9 +1684,8 @@ - (void)launchInitialServerSync

if (networkReachabilityManager.isReachable)
{
// The problem is not the network
// Postpone a new attempt in 10 sec
self->initialServerSyncTimer = [NSTimer scheduledTimerWithTimeInterval:10 target:self selector:@selector(launchInitialServerSync) userInfo:self repeats:NO];
// If we have network, we retry immediately, otherwise the server may clear any cache it has computed thus far
[self launchInitialServerSync];
}
else
{
Expand Down
2 changes: 2 additions & 0 deletions changelog.d/pr-7068.change
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Initial sync: Remove 10s wait on failed initial sync