Skip to content

Commit

Permalink
Treat completing a client reset as receiving a MARK message
Browse files Browse the repository at this point in the history
  • Loading branch information
tgoyne committed Jul 23, 2024
1 parent 3352e77 commit 7e04f66
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/realm/sync/noinst/client_impl_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2317,13 +2317,19 @@ bool Session::client_reset_if_needed()
m_progress.download.last_integrated_client_version);
REALM_ASSERT_EX(m_progress.upload.client_version == 0, m_progress.upload.client_version);

// Reset the cached values which are used to calculate progress since the
// last time sync completed
init_progress_handler();

// Update the download progress to match what it would have been if we'd
// received a MARK message from the server (as the fresh Realm which we used
// as the source data for the reset did).
m_upload_progress = m_progress.upload;
m_download_progress = m_progress.download;
init_progress_handler();
// In recovery mode, there may be new changesets to upload and nothing left to download.
// In FLX DiscardLocal mode, there may be new commits due to subscription handling.
// For both, we want to allow uploads again without needing external changes to download first.
m_delay_uploads = false;
m_server_version_at_last_download_mark = m_progress.download.server_version;
m_last_download_mark_received = m_last_download_mark_sent;
m_last_triggering_download_mark = 0;
check_for_download_completion();

// Checks if there is a pending client reset
handle_pending_client_reset_acknowledgement();
Expand Down

0 comments on commit 7e04f66

Please sign in to comment.