From 93582663d8e6385964ba4e18e1e4a2eebd0d0b38 Mon Sep 17 00:00:00 2001 From: jiacai2050 Date: Sat, 21 Dec 2024 21:52:32 +0800 Subject: [PATCH] fix ci --- src/server/Cargo.toml | 2 +- src/server/src/config.rs | 2 ++ src/server/src/main.rs | 12 +++++++++--- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/server/Cargo.toml b/src/server/Cargo.toml index 6bf0bd9e1b..f38d3f185d 100644 --- a/src/server/Cargo.toml +++ b/src/server/Cargo.toml @@ -43,4 +43,4 @@ serde = { workspace = true } tokio = { workspace = true } toml = { workspace = true } tracing = { workspace = true } -tracing-subscriber = { workspace = true , features = ["local-time"]} +tracing-subscriber = { workspace = true, features = ["local-time"] } diff --git a/src/server/src/config.rs b/src/server/src/config.rs index 63f12a6fd4..2e02daf60d 100644 --- a/src/server/src/config.rs +++ b/src/server/src/config.rs @@ -41,6 +41,7 @@ impl Default for Config { pub struct TestConfig { pub enable_write: bool, pub write_worker_num: usize, + pub write_interval: ReadableDuration, } impl Default for TestConfig { @@ -48,6 +49,7 @@ impl Default for TestConfig { Self { enable_write: true, write_worker_num: 1, + write_interval: ReadableDuration::millis(500), } } } diff --git a/src/server/src/main.rs b/src/server/src/main.rs index a16e42e220..ab5a93611e 100644 --- a/src/server/src/main.rs +++ b/src/server/src/main.rs @@ -94,6 +94,7 @@ pub fn main() { StorageConfig::S3Like(_) => panic!("S3 not support yet"), }; let write_worker_num = config.test.write_worker_num; + let write_interval = config.test.write_interval.0; let enable_write = config.test.enable_write; let write_rt = build_multi_runtime("write", write_worker_num); let _ = rt.block_on(async move { @@ -113,7 +114,12 @@ pub fn main() { ); if enable_write { - bench_write(write_rt.clone(), write_worker_num, storage.clone()); + bench_write( + storage.clone(), + write_rt.clone(), + write_worker_num, + write_interval, + ); } let app_state = Data::new(AppState { storage }); @@ -152,7 +158,7 @@ fn build_schema() -> SchemaRef { ])) } -fn bench_write(rt: RuntimeRef, workers: usize, storage: TimeMergeStorageRef) { +fn bench_write(storage: TimeMergeStorageRef, rt: RuntimeRef, workers: usize, interval: Duration) { let schema = Arc::new(Schema::new(vec![ Field::new("pk1", DataType::Int64, true), Field::new("pk2", DataType::Int64, true), @@ -184,7 +190,7 @@ fn bench_write(rt: RuntimeRef, workers: usize, storage: TimeMergeStorageRef) { { error!("write failed, err:{}", e); } - tokio::time::sleep(Duration::from_millis(1000)).await; + tokio::time::sleep(interval).await; } }); }