fix doAdd cloud api and provide operations count (#2154)

This commit is contained in:
Brendan Allan 2024-03-01 18:41:47 +08:00 committed by GitHub
parent 8e271c007f
commit 54af5a822f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

View file

@ -66,6 +66,8 @@ pub async fn run_actor(
let start_time = ops[0].timestamp.0.to_string();
let end_time = ops[ops.len() - 1].timestamp.0.to_string();
let ops_len = ops.len();
instances.push(do_add::Input {
uuid: req_add.instance_uuid,
key: req_add.key,
@ -73,6 +75,7 @@ pub async fn run_actor(
end_time,
contents: serde_json::to_value(CompressedCRDTOperations::new(ops))
.expect("CompressedCRDTOperation should serialize!"),
ops_count: ops_len,
})
}

View file

@ -451,6 +451,7 @@ pub mod library {
pub start_time: String,
pub end_time: String,
pub contents: serde_json::Value,
pub ops_count: usize,
}
pub async fn exec(
@ -465,7 +466,7 @@ pub mod library {
config
.client
.post(&format!(
"{}/api/v1/libraries/{}/messageCollections/requestAdd",
"{}/api/v1/libraries/{}/messageCollections/doAdd",
config.api_url, library_id
))
.json(&json!({ "instances": instances }))