Broadcast operations when synchronizing with the server

This commit is contained in:
Antonio Scandurra 2023-07-25 10:05:59 +02:00
parent 9358958b1f
commit 31f84cef14
2 changed files with 6 additions and 2 deletions

View file

@ -257,7 +257,7 @@ impl<E: Executor, N: ClientNetwork> Checkout<E, N> {
.expect("network is infallible"); .expect("network is infallible");
for operation in operations { for operation in operations {
this.network_room this.network_room
.broadcast(MessageEnvelope::Operation(operation.clone()).to_bytes()); .broadcast(MessageEnvelope::Operation(operation).to_bytes());
} }
} }
} }
@ -303,6 +303,10 @@ impl<E: Executor, N: ClientNetwork> Checkout<E, N> {
operations: chunk.to_vec(), operations: chunk.to_vec(),
}) })
.await?; .await?;
for operation in chunk {
self.network_room
.broadcast(MessageEnvelope::Operation(operation.clone()).to_bytes());
}
} }
Ok(()) Ok(())

View file

@ -90,7 +90,7 @@ impl Into<RequestEnvelope> for SyncRepo {
} }
} }
#[derive(Clone, Serialize, Deserialize)] #[derive(Clone, Debug, Serialize, Deserialize)]
pub struct SyncRepoResponse { pub struct SyncRepoResponse {
pub operations: Vec<Operation>, pub operations: Vec<Operation>,
pub max_operation_ids: BTreeMap<ReplicaId, OperationCount>, pub max_operation_ids: BTreeMap<ReplicaId, OperationCount>,