Skip to content

Commit

Permalink
fix ci
Browse files Browse the repository at this point in the history
  • Loading branch information
jiacai2050 committed Dec 21, 2024
1 parent cbe305d commit 9358266
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
2 changes: 2 additions & 0 deletions src/server/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,15 @@ impl Default for Config {
pub struct TestConfig {
pub enable_write: bool,
pub write_worker_num: usize,
pub write_interval: ReadableDuration,
}

impl Default for TestConfig {
fn default() -> Self {
Self {
enable_write: true,
write_worker_num: 1,
write_interval: ReadableDuration::millis(500),
}
}
}
Expand Down
12 changes: 9 additions & 3 deletions src/server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 });
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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;
}
});
}
Expand Down

0 comments on commit 9358266

Please sign in to comment.