chore: enable feature log for client api (#430)
* chore: enable feature log for client api * chore: fix ci
This commit is contained in:
parent
ccd11f0b02
commit
0821c052f9
|
|
@ -99,7 +99,7 @@ tempfile = "3.9.0"
|
|||
assert-json-diff = "2.0.2"
|
||||
scraper = "0.17.1"
|
||||
client-api-test-util = { path = "libs/client-api-test-util" }
|
||||
client-api = { path = "libs/client-api", features = ["collab-sync", "test_util", "test_fast_sync"] }
|
||||
client-api = { path = "libs/client-api", features = ["collab-sync", "test_util", "sync_verbose_log"] }
|
||||
opener = "0.6.1"
|
||||
image = "0.23.14"
|
||||
collab-folder = { version = "0.1.0" }
|
||||
|
|
|
|||
|
|
@ -66,6 +66,5 @@ again = "0.1.2"
|
|||
[features]
|
||||
collab-sync = ["collab", "yrs"]
|
||||
test_util = ["scraper"]
|
||||
test_fast_sync = []
|
||||
template = ["workspace-template"]
|
||||
ws_verbose_log = []
|
||||
sync_verbose_log = []
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ pub struct CollabSink<Sink> {
|
|||
|
||||
impl<Sink> Drop for CollabSink<Sink> {
|
||||
fn drop(&mut self) {
|
||||
#[cfg(feature = "sync_verbose_log")]
|
||||
trace!("Drop CollabSink {}", self.object.object_id);
|
||||
let _ = self.notifier.send(SinkSignal::Stop);
|
||||
}
|
||||
|
|
@ -284,6 +285,7 @@ where
|
|||
);
|
||||
}
|
||||
} else {
|
||||
#[cfg(feature = "sync_verbose_log")]
|
||||
trace!(
|
||||
"{}: pending count:{} ids:{}",
|
||||
self.object.object_id,
|
||||
|
|
@ -337,6 +339,7 @@ where
|
|||
self.last_sync.update_timestamp().await;
|
||||
match sender.send(messages).await {
|
||||
Ok(_) => {
|
||||
#[cfg(feature = "sync_verbose_log")]
|
||||
trace!(
|
||||
"🔥client sending {} messages {:?}",
|
||||
self.object.object_id,
|
||||
|
|
@ -402,6 +405,7 @@ where
|
|||
|
||||
if cfg!(debug_assertions) {
|
||||
for (msg_id, merged_ids) in merged_ids {
|
||||
#[cfg(feature = "sync_verbose_log")]
|
||||
trace!(
|
||||
"{}: merged {:?} messages into: {:?}",
|
||||
self.object.object_id,
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ pub struct ObserveCollab<Sink, Stream> {
|
|||
|
||||
impl<Sink, Stream> Drop for ObserveCollab<Sink, Stream> {
|
||||
fn drop(&mut self) {
|
||||
#[cfg(feature = "sync_verbose_log")]
|
||||
trace!("Drop SyncStream {}", self.object_id);
|
||||
}
|
||||
}
|
||||
|
|
@ -229,6 +230,7 @@ where
|
|||
.await
|
||||
{
|
||||
if let Some(lock_guard) = collab.try_lock() {
|
||||
#[cfg(feature = "sync_verbose_log")]
|
||||
trace!("Start pull missing updates for {}", object.object_id);
|
||||
start_sync(origin.clone(), object, &lock_guard, sink);
|
||||
}
|
||||
|
|
@ -321,6 +323,7 @@ pub(crate) fn check_update_contiguous(
|
|||
seq_num_counter: &Arc<SeqNumCounter>,
|
||||
) -> Result<(), SyncError> {
|
||||
let prev_seq_num = seq_num_counter.fetch_update(current_seq_num);
|
||||
#[cfg(feature = "sync_verbose_log")]
|
||||
trace!(
|
||||
"receive {} seq_num, prev:{}, current:{}",
|
||||
object_id,
|
||||
|
|
|
|||
|
|
@ -154,6 +154,7 @@ where
|
|||
let payload = Message::Awareness(update.clone()).encode_v1();
|
||||
self.sync_queue.queue_msg(|msg_id| {
|
||||
let update_sync = UpdateSync::new(origin.clone(), object_id.to_string(), payload, msg_id);
|
||||
#[cfg(feature = "sync_verbose_log")]
|
||||
trace!("queue local state: {}", update_sync);
|
||||
ClientCollabMessage::new_update_sync(update_sync)
|
||||
});
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ where
|
|||
}
|
||||
|
||||
pub(crate) fn push_msg(&mut self, msg_id: MsgId, msg: Msg) {
|
||||
#[cfg(feature = "sync_verbose_log")]
|
||||
trace!("📩 queue: {}", msg);
|
||||
self.queue.push(QueueItem::new(msg, msg_id));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ pub struct SyncControl<Sink, Stream> {
|
|||
|
||||
impl<Sink, Stream> Drop for SyncControl<Sink, Stream> {
|
||||
fn drop(&mut self) {
|
||||
#[cfg(feature = "sync_verbose_log")]
|
||||
trace!("Drop SyncQueue {}", self.object.object_id);
|
||||
}
|
||||
}
|
||||
|
|
@ -115,11 +116,13 @@ where
|
|||
}
|
||||
|
||||
pub fn pause(&self) {
|
||||
#[cfg(feature = "sync_verbose_log")]
|
||||
trace!("pause {} sync", self.object.object_id);
|
||||
self.sink.pause();
|
||||
}
|
||||
|
||||
pub fn resume(&self) {
|
||||
#[cfg(feature = "sync_verbose_log")]
|
||||
trace!("resume {} sync", self.object.object_id);
|
||||
self.sink.resume();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -434,6 +434,7 @@ fn handle_collab_message(
|
|||
if let Some(channels) = collab_channels.read().get(&object_id) {
|
||||
for channel in channels.iter() {
|
||||
if let Some(channel) = channel.upgrade() {
|
||||
#[cfg(feature = "sync_verbose_log")]
|
||||
trace!("🌐receive server: {}", collab_msg);
|
||||
channel.forward_to_stream(collab_msg.clone());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -189,6 +189,7 @@ fn log_message_map(messages_map: &HashMap<String, Vec<ClientCollabMessage>>) {
|
|||
// Prepend the start sign and append the end sign to the log message
|
||||
let log_msg = format!("{}\n{}\n{}", start_sign, log_msg, end_sign);
|
||||
|
||||
#[cfg(feature = "sync_verbose_log")]
|
||||
debug!("Aggregate message list:\n{}", log_msg);
|
||||
}
|
||||
|
||||
|
|
@ -220,10 +221,8 @@ fn calculate_next_tick_duration(
|
|||
num_init_sync: usize,
|
||||
default_interval: Duration,
|
||||
) -> Duration {
|
||||
if cfg!(feature = "test_fast_sync") {
|
||||
Duration::from_secs(1)
|
||||
} else if num_messages == 0 {
|
||||
Duration::from_secs(4)
|
||||
if num_messages == 0 {
|
||||
Duration::from_secs(2)
|
||||
} else {
|
||||
match num_init_sync {
|
||||
0 => default_interval,
|
||||
|
|
|
|||
Loading…
Reference in New Issue