Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

use flowy_unit_test to make backend test work

appflowy353bdc592bdb
diff --git a/frontend/rust-lib/flowy-sync/src/cache/mod.rs b/frontend/rust-lib/flowy-sync/src/cache/mod.rs
index f80799df62..d1fffb9664 100755
--- a/frontend/rust-lib/flowy-sync/src/cache/mod.rs
+++ b/frontend/rust-lib/flowy-sync/src/cache/mod.rs
@@ -67,6 +67,7 @@ impl RevisionCache {
Ok(record)
}
+ #[allow(dead_code)]
pub async fn ack(&self, rev_id: i64) {
self.memory_cache.ack(&rev_id).await;
}
diff --git a/frontend/rust-lib/flowy-sync/src/rev_manager.rs b/frontend/rust-lib/flowy-sync/src/rev_manager.rs
index 04e367ee47..03b088578f 100755
--- a/frontend/rust-lib/flowy-sync/src/rev_manager.rs
+++ b/frontend/rust-lib/flowy-sync/src/rev_manager.rs
@@ -105,13 +105,13 @@ impl RevisionManager {
#[tracing::instrument(level = "debug", skip(self), err)]
pub async fn ack_revision(&self, rev_id: i64) -> Result<(), FlowyError> {
- // For the moment, we comment out the following code in order to cause sync bugs.
- // if self.revision_sync_seq.ack(&rev_id).await.is_ok() {
- // self.revision_cache.ack(rev_id).await;
- //
- // #[cfg(feature = "flowy_unit_test")]
- // let _ = self.revision_ack_notifier.send(rev_id);
- // }
+ #[cfg(feature = "flowy_unit_test")]
+ if self.revision_sync_seq.ack(&rev_id).await.is_ok() {
+ self.revision_cache.ack(rev_id).await;
+
+ #[cfg(feature = "flowy_unit_test")]
+ let _ = self.revision_ack_notifier.send(rev_id);
+ }
Ok(())
}
@@ -192,6 +192,7 @@ impl RevisionSyncSequence {
Ok(())
}
+ #[allow(dead_code)]
async fn ack(&self, rev_id: &i64) -> FlowyResult<()> {
if let Some(pop_rev_id) = self.next_sync_rev_id().await {
if &pop_rev_id != rev_id {