chore: try to fix inifinite sync (#756)

This commit is contained in:
Nathan.fooo 2024-08-27 16:41:19 +08:00 committed by GitHub
parent ed2a3fd1ee
commit c8ee6b43ee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 6 additions and 5 deletions

View File

@ -222,7 +222,7 @@ where
},
Some(sv) => {
trace!(
"🔥{} start init sync, reason:{}",
"🔥{} start init sync with state vector, reason:{}",
&sync_object.object_id,
reason
);

View File

@ -258,7 +258,7 @@ pub enum RTProtocolError {
#[error("Missing Updates")]
MissUpdates {
/// - `state_vector_v1`: Contains the last known state vector from the client. If `None`,
/// - `state_vector_v1`: Contains the last known state vector from the Collab. If `None`,
/// this indicates that the receiver needs to perform a full initialization synchronization starting from sync step 0.
///
/// The receiver uses this information to determine how to recover from the error,

View File

@ -68,9 +68,9 @@ impl CollabSyncProtocol for ClientSyncProtocol {
update.missing.is_empty()
);
}
// let state_vector_v1 = update.missing.encode_v1();
let state_vector_v1 = txn.state_vector().encode_v1();
Err(RTProtocolError::MissUpdates {
state_vector_v1: None,
state_vector_v1: Some(state_vector_v1),
reason: "client miss updates".to_string(),
})
},

View File

@ -67,8 +67,9 @@ impl CollabSyncProtocol for ServerSyncProtocol {
// let state_vector_v1 = update.missing.encode_v1();
// for the moment, we don't need to send missing updates to the client. passing None
// instead, which will trigger a sync step 0 on client
let state_vector_v1 = txn.state_vector().encode_v1();
Err(RTProtocolError::MissUpdates {
state_vector_v1: None,
state_vector_v1: Some(state_vector_v1),
reason: "server miss updates".to_string(),
})
},