File tree 1 file changed +17
-4
lines changed
1 file changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -99,19 +99,32 @@ async fn set_status(num_activations: u32, num_workers: u32) {
99
99
) ;
100
100
101
101
let mut join_set = JoinSet :: new ( ) ;
102
- for i in 0 ..num_workers {
102
+ for worker_idx in 0 ..num_workers {
103
103
let store = store. clone ( ) ;
104
104
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 {
107
107
store
108
- . set_status ( & format ! ( "id_{}" , i) , InflightActivationStatus :: Complete )
108
+ . set_status (
109
+ & format ! ( "id_{}" , task_id) ,
110
+ InflightActivationStatus :: Complete ,
111
+ )
109
112
. await
110
113
. unwrap ( ) ;
111
114
}
112
115
}
113
116
} ) ;
114
117
}
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
+ ) ;
115
128
}
116
129
117
130
fn store_bench ( c : & mut Criterion ) {
You can’t perform that action at this time.
0 commit comments