chore: fixed collab ack

This commit is contained in:
Bartosz Sypytkowski 2024-10-23 10:52:37 +02:00
parent fc1a7d28e2
commit f684d3623d
2 changed files with 11 additions and 6 deletions

View File

@ -200,7 +200,7 @@ impl CollabGroup {
sv.merge(update.state_vector);
drop(sv);
let seq_num = state.seq_no.fetch_add(1, Ordering::SeqCst);
let seq_num = state.seq_no.fetch_add(1, Ordering::SeqCst) + 1;
tracing::trace!(
"broadcasting collab update from {} ({} bytes) - seq_num: {}",
update.sender,
@ -493,7 +493,7 @@ impl CollabGroup {
message_origin,
state.object_id.to_string(),
msg_id,
state.seq_no.fetch_add(1, Ordering::SeqCst),
state.seq_no.load(Ordering::SeqCst),
));
}
@ -547,7 +547,7 @@ impl CollabGroup {
message_origin.clone(),
state.object_id.to_string(),
msg_id,
state.seq_no.fetch_add(1, Ordering::SeqCst),
state.seq_no.load(Ordering::SeqCst),
)
.with_payload(payload.unwrap_or_default()),
);
@ -571,7 +571,7 @@ impl CollabGroup {
message_origin.clone(),
state.object_id.to_string(),
msg_id,
state.seq_no.fetch_add(1, Ordering::SeqCst),
state.seq_no.load(Ordering::SeqCst),
)
.with_code(code)
.with_payload(payload),

View File

@ -1,4 +1,4 @@
use std::time::Duration;
use std::time::{Duration, Instant};
use anyhow::Context;
use collab::core::origin::CollabOrigin;
@ -134,7 +134,12 @@ impl TestScenario {
}
pub async fn execute(&self, collab: CollabRef) -> String {
for t in self.txns.iter() {
let len = self.txns.len();
let start = Instant::now();
for (i, t) in self.txns.iter().take(50_000).enumerate() {
if i % 10_000 == 0 {
tracing::trace!("step #{}/{} - {:?}", i + 1, len, start.elapsed());
}
let mut lock = collab.write().await;
let collab = lock.borrow_mut();
let mut txn = collab.context.transact_mut();