Skip to content

Commit 79f6e42

Browse files
authored
fix(bench): fix benchmark test (#249)
1 parent d54b137 commit 79f6e42

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

benches/store_bench.rs

+17-4
Original file line numberDiff line numberDiff line change
@@ -99,19 +99,32 @@ async fn set_status(num_activations: u32, num_workers: u32) {
9999
);
100100

101101
let mut join_set = JoinSet::new();
102-
for i in 0..num_workers {
102+
for worker_idx in 0..num_workers {
103103
let store = store.clone();
104104
join_set.spawn(async move {
105-
for idx in 0..num_activations {
106-
if idx % num_workers == i {
105+
for task_id in 0..num_activations {
106+
if task_id % num_workers == worker_idx {
107107
store
108-
.set_status(&format!("id_{}", i), InflightActivationStatus::Complete)
108+
.set_status(
109+
&format!("id_{}", task_id),
110+
InflightActivationStatus::Complete,
111+
)
109112
.await
110113
.unwrap();
111114
}
112115
}
113116
});
114117
}
118+
119+
join_set.join_all().await;
120+
121+
assert_eq!(
122+
store
123+
.count_by_status(InflightActivationStatus::Complete)
124+
.await
125+
.unwrap(),
126+
num_activations as usize
127+
);
115128
}
116129

117130
fn store_bench(c: &mut Criterion) {

0 commit comments

Comments
 (0)