chore: bump collab (#4327)

This commit is contained in:
Nathan.fooo 2024-01-08 08:21:57 +08:00 committed by GitHub
parent c4ebccafd4
commit 4ee6e297c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 79 additions and 63 deletions

View File

@ -780,7 +780,7 @@ dependencies = [
[[package]]
name = "collab"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=6d9cb684cf6735981de8de3b59e547fa8abc57f7#6d9cb684cf6735981de8de3b59e547fa8abc57f7"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=fe8f08fcc99ea56c78bfb746ccb0cd308126141d#fe8f08fcc99ea56c78bfb746ccb0cd308126141d"
dependencies = [
"anyhow",
"async-trait",
@ -800,7 +800,7 @@ dependencies = [
[[package]]
name = "collab-database"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=6d9cb684cf6735981de8de3b59e547fa8abc57f7#6d9cb684cf6735981de8de3b59e547fa8abc57f7"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=fe8f08fcc99ea56c78bfb746ccb0cd308126141d#fe8f08fcc99ea56c78bfb746ccb0cd308126141d"
dependencies = [
"anyhow",
"async-trait",
@ -827,7 +827,7 @@ dependencies = [
[[package]]
name = "collab-document"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=6d9cb684cf6735981de8de3b59e547fa8abc57f7#6d9cb684cf6735981de8de3b59e547fa8abc57f7"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=fe8f08fcc99ea56c78bfb746ccb0cd308126141d#fe8f08fcc99ea56c78bfb746ccb0cd308126141d"
dependencies = [
"anyhow",
"collab",
@ -845,7 +845,7 @@ dependencies = [
[[package]]
name = "collab-entity"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=6d9cb684cf6735981de8de3b59e547fa8abc57f7#6d9cb684cf6735981de8de3b59e547fa8abc57f7"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=fe8f08fcc99ea56c78bfb746ccb0cd308126141d#fe8f08fcc99ea56c78bfb746ccb0cd308126141d"
dependencies = [
"anyhow",
"bytes",
@ -859,7 +859,7 @@ dependencies = [
[[package]]
name = "collab-folder"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=6d9cb684cf6735981de8de3b59e547fa8abc57f7#6d9cb684cf6735981de8de3b59e547fa8abc57f7"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=fe8f08fcc99ea56c78bfb746ccb0cd308126141d#fe8f08fcc99ea56c78bfb746ccb0cd308126141d"
dependencies = [
"anyhow",
"chrono",
@ -895,7 +895,7 @@ dependencies = [
[[package]]
name = "collab-plugins"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=6d9cb684cf6735981de8de3b59e547fa8abc57f7#6d9cb684cf6735981de8de3b59e547fa8abc57f7"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=fe8f08fcc99ea56c78bfb746ccb0cd308126141d#fe8f08fcc99ea56c78bfb746ccb0cd308126141d"
dependencies = [
"anyhow",
"async-trait",
@ -925,7 +925,7 @@ dependencies = [
[[package]]
name = "collab-user"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=6d9cb684cf6735981de8de3b59e547fa8abc57f7#6d9cb684cf6735981de8de3b59e547fa8abc57f7"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=fe8f08fcc99ea56c78bfb746ccb0cd308126141d#fe8f08fcc99ea56c78bfb746ccb0cd308126141d"
dependencies = [
"anyhow",
"collab",

View File

@ -67,13 +67,13 @@ client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "215
# To switch to the local path, run:
# scripts/tool/update_collab_source.sh
# ⚠️⚠️⚠️️
collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "6d9cb684cf6735981de8de3b59e547fa8abc57f7" }
collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "6d9cb684cf6735981de8de3b59e547fa8abc57f7" }
collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "6d9cb684cf6735981de8de3b59e547fa8abc57f7" }
collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "6d9cb684cf6735981de8de3b59e547fa8abc57f7" }
collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "6d9cb684cf6735981de8de3b59e547fa8abc57f7" }
collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "6d9cb684cf6735981de8de3b59e547fa8abc57f7" }
collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "6d9cb684cf6735981de8de3b59e547fa8abc57f7" }
collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "fe8f08fcc99ea56c78bfb746ccb0cd308126141d" }
collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "fe8f08fcc99ea56c78bfb746ccb0cd308126141d" }
collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "fe8f08fcc99ea56c78bfb746ccb0cd308126141d" }
collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "fe8f08fcc99ea56c78bfb746ccb0cd308126141d" }
collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "fe8f08fcc99ea56c78bfb746ccb0cd308126141d" }
collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "fe8f08fcc99ea56c78bfb746ccb0cd308126141d" }
collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "fe8f08fcc99ea56c78bfb746ccb0cd308126141d" }

View File

@ -686,7 +686,7 @@ dependencies = [
[[package]]
name = "collab"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=6d9cb684cf6735981de8de3b59e547fa8abc57f7#6d9cb684cf6735981de8de3b59e547fa8abc57f7"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=fe8f08fcc99ea56c78bfb746ccb0cd308126141d#fe8f08fcc99ea56c78bfb746ccb0cd308126141d"
dependencies = [
"anyhow",
"async-trait",
@ -706,7 +706,7 @@ dependencies = [
[[package]]
name = "collab-database"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=6d9cb684cf6735981de8de3b59e547fa8abc57f7#6d9cb684cf6735981de8de3b59e547fa8abc57f7"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=fe8f08fcc99ea56c78bfb746ccb0cd308126141d#fe8f08fcc99ea56c78bfb746ccb0cd308126141d"
dependencies = [
"anyhow",
"async-trait",
@ -733,7 +733,7 @@ dependencies = [
[[package]]
name = "collab-document"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=6d9cb684cf6735981de8de3b59e547fa8abc57f7#6d9cb684cf6735981de8de3b59e547fa8abc57f7"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=fe8f08fcc99ea56c78bfb746ccb0cd308126141d#fe8f08fcc99ea56c78bfb746ccb0cd308126141d"
dependencies = [
"anyhow",
"collab",
@ -751,7 +751,7 @@ dependencies = [
[[package]]
name = "collab-entity"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=6d9cb684cf6735981de8de3b59e547fa8abc57f7#6d9cb684cf6735981de8de3b59e547fa8abc57f7"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=fe8f08fcc99ea56c78bfb746ccb0cd308126141d#fe8f08fcc99ea56c78bfb746ccb0cd308126141d"
dependencies = [
"anyhow",
"bytes",
@ -765,7 +765,7 @@ dependencies = [
[[package]]
name = "collab-folder"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=6d9cb684cf6735981de8de3b59e547fa8abc57f7#6d9cb684cf6735981de8de3b59e547fa8abc57f7"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=fe8f08fcc99ea56c78bfb746ccb0cd308126141d#fe8f08fcc99ea56c78bfb746ccb0cd308126141d"
dependencies = [
"anyhow",
"chrono",
@ -801,7 +801,7 @@ dependencies = [
[[package]]
name = "collab-plugins"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=6d9cb684cf6735981de8de3b59e547fa8abc57f7#6d9cb684cf6735981de8de3b59e547fa8abc57f7"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=fe8f08fcc99ea56c78bfb746ccb0cd308126141d#fe8f08fcc99ea56c78bfb746ccb0cd308126141d"
dependencies = [
"anyhow",
"async-trait",
@ -831,7 +831,7 @@ dependencies = [
[[package]]
name = "collab-user"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=6d9cb684cf6735981de8de3b59e547fa8abc57f7#6d9cb684cf6735981de8de3b59e547fa8abc57f7"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=fe8f08fcc99ea56c78bfb746ccb0cd308126141d#fe8f08fcc99ea56c78bfb746ccb0cd308126141d"
dependencies = [
"anyhow",
"collab",

View File

@ -117,10 +117,10 @@ client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "215
# To switch to the local path, run:
# scripts/tool/update_collab_source.sh
# ⚠️⚠️⚠️️
collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "6d9cb684cf6735981de8de3b59e547fa8abc57f7" }
collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "6d9cb684cf6735981de8de3b59e547fa8abc57f7" }
collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "6d9cb684cf6735981de8de3b59e547fa8abc57f7" }
collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "6d9cb684cf6735981de8de3b59e547fa8abc57f7" }
collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "6d9cb684cf6735981de8de3b59e547fa8abc57f7" }
collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "6d9cb684cf6735981de8de3b59e547fa8abc57f7" }
collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "6d9cb684cf6735981de8de3b59e547fa8abc57f7" }
collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "fe8f08fcc99ea56c78bfb746ccb0cd308126141d" }
collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "fe8f08fcc99ea56c78bfb746ccb0cd308126141d" }
collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "fe8f08fcc99ea56c78bfb746ccb0cd308126141d" }
collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "fe8f08fcc99ea56c78bfb746ccb0cd308126141d" }
collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "fe8f08fcc99ea56c78bfb746ccb0cd308126141d" }
collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "fe8f08fcc99ea56c78bfb746ccb0cd308126141d" }
collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "fe8f08fcc99ea56c78bfb746ccb0cd308126141d" }

View File

@ -33,7 +33,7 @@ use parking_lot::{Mutex, RwLock};
use std::collections::{HashMap, HashSet};
use std::ops::{Deref, DerefMut};
use std::sync::Arc;
use tracing::{debug, event, info, instrument};
use tracing::{debug, error, event, info, instrument};
pub(crate) struct ImportContext {
pub imported_session: Session,
@ -639,25 +639,17 @@ pub async fn upload_imported_data(
);
for (oid, encoded_collab) in encoded_collab_by_oid {
let obj_size = encoded_collab.len();
// When the limit is exceeded, batch create with the current list of objects
// and reset for the next batch.
if size_counter + obj_size > upload_size_limit && !objects.is_empty() {
// When the limit is exceeded, batch create with the current list of objects
// and reset for the next batch.
info!(
"Exceeded maximum payload size. Batch creating collab objects: {}, payload size: {}",
objects
.iter()
.map(|o| o.object_id.clone())
.collect::<Vec<_>>()
.join(", "),
size_counter
);
if let Err(e) = user_cloud_service
.batch_create_collab_object(workspace_id, objects)
.await
{
tracing::error!("batch create collab object failed: {:?}", e);
}
batch_create(
uid,
workspace_id,
&user_cloud_service,
&size_counter,
objects,
)
.await;
objects = Vec::new();
size_counter = 0;
@ -675,26 +667,50 @@ pub async fn upload_imported_data(
// After the loop, upload any remaining objects.
if !objects.is_empty() {
info!(
"Batch create collab objects: {}, payload size: {}",
objects
.iter()
.map(|o| o.object_id.clone())
.collect::<Vec<_>>()
.join(", "),
size_counter
);
if let Err(e) = user_cloud_service
.batch_create_collab_object(workspace_id, objects)
.await
{
tracing::error!("batch create collab object failed: {:?}", e);
}
batch_create(
uid,
workspace_id,
&user_cloud_service,
&size_counter,
objects,
)
.await;
}
Ok(())
}
async fn batch_create(
uid: i64,
workspace_id: &str,
user_cloud_service: &Arc<dyn UserCloudService>,
size_counter: &usize,
objects: Vec<UserCollabParams>,
) {
let ids = objects
.iter()
.map(|o| o.object_id.clone())
.collect::<Vec<_>>()
.join(", ");
match user_cloud_service
.batch_create_collab_object(workspace_id, objects)
.await
{
Ok(_) => {
info!(
"Batch creating collab objects success: {}, payload size: {}",
ids, size_counter
);
},
Err(err) => {
error!(
"Batch creating collab objects fail:{}, payload size: {}, workspace_id:{}, uid: {}, error: {:?}",
ids, size_counter, workspace_id, uid,err
);
},
}
}
#[instrument(level = "debug", skip_all)]
fn load_and_process_collab_data<'a, R>(
uid: i64,