chore: turn off separate appflowy history process

This commit is contained in:
Bartosz Sypytkowski 2024-10-21 06:41:15 +02:00
parent 0a2cb3a79e
commit 0b7ee402ff
3 changed files with 19 additions and 22 deletions

View File

@ -53,7 +53,7 @@ then
cargo sqlx prepare --workspace cargo sqlx prepare --workspace
fi fi
cargo run --package xtask cargo run --release --package xtask
# revert to require signup email verification # revert to require signup email verification
export GOTRUE_MAILER_AUTOCONFIRM=false export GOTRUE_MAILER_AUTOCONFIRM=false

View File

@ -903,7 +903,15 @@ impl CollabPersister {
async fn load_internal(&self, skip_gc: bool) -> Result<CollabSnapshot, RealtimeError> { async fn load_internal(&self, skip_gc: bool) -> Result<CollabSnapshot, RealtimeError> {
// 1. Try to load the latest snapshot from storage // 1. Try to load the latest snapshot from storage
let mut collab = self.load_collab_full(skip_gc).await?; let mut collab = match self.load_collab_full(skip_gc).await? {
Some(collab) => collab,
None => Collab::new_with_origin(
CollabOrigin::Server,
self.object_id.clone(),
vec![],
skip_gc,
),
};
// 2. consume all Redis updates on top of it (keep redis msg id) // 2. consume all Redis updates on top of it (keep redis msg id)
let mut last_message_id = None; let mut last_message_id = None;
@ -1062,7 +1070,7 @@ impl CollabPersister {
} }
} }
async fn load_collab_full(&self, keep_history: bool) -> Result<Collab, RealtimeError> { async fn load_collab_full(&self, keep_history: bool) -> Result<Option<Collab>, RealtimeError> {
let doc_state = if keep_history { let doc_state = if keep_history {
// if we want history-keeping variant, we need to get a snapshot // if we want history-keeping variant, we need to get a snapshot
let snapshot = self let snapshot = self
@ -1090,12 +1098,15 @@ impl CollabPersister {
self.collab_type.clone(), self.collab_type.clone(),
self.workspace_id.clone(), self.workspace_id.clone(),
); );
self let result = self
.storage .storage
.get_encode_collab(GetCollabOrigin::Server, params, false) .get_encode_collab(GetCollabOrigin::Server, params, false)
.await .await;
.map_err(|err| RealtimeError::Internal(err.into()))? match result {
.doc_state Ok(encoded_collab) => encoded_collab.doc_state,
Err(AppError::RecordNotFound(_)) => return Ok(None),
Err(err) => return Err(RealtimeError::Internal(err.into())),
}
}, },
}; };
@ -1106,7 +1117,7 @@ impl CollabPersister {
vec![], vec![],
keep_history, // should we use history-remembering version (true) or lightweight one (false)? keep_history, // should we use history-remembering version (true) or lightweight one (false)?
)?; )?;
Ok(collab) Ok(Some(collab))
} }
} }

View File

@ -24,17 +24,6 @@ async fn main() -> Result<()> {
.spawn() .spawn()
.context("Failed to start AppFlowy-Cloud process")?; .context("Failed to start AppFlowy-Cloud process")?;
let mut appflowy_history_cmd = Command::new("cargo")
.args([
"run",
// "--features",
// "verbose_log",
"--manifest-path",
"./services/appflowy-history/Cargo.toml",
])
.spawn()
.context("Failed to start AppFlowy-History process")?;
let mut appflowy_worker_cmd = Command::new("cargo") let mut appflowy_worker_cmd = Command::new("cargo")
.args([ .args([
"run", "run",
@ -48,9 +37,6 @@ async fn main() -> Result<()> {
status = appflowy_cloud_cmd.wait() => { status = appflowy_cloud_cmd.wait() => {
handle_process_exit(status?, appflowy_cloud_bin_name)?; handle_process_exit(status?, appflowy_cloud_bin_name)?;
}, },
status = appflowy_history_cmd.wait() => {
handle_process_exit(status?, history)?;
}
status = appflowy_worker_cmd.wait() => { status = appflowy_worker_cmd.wait() => {
handle_process_exit(status?, worker)?; handle_process_exit(status?, worker)?;
} }