|
14 | 14 |
|
15 | 15 | ///| |
16 | 16 | async test "protect_from_cancel" { |
17 | | - random_delay() |
| 17 | + rate_limit.acquire() |
| 18 | + defer rate_limit.release() |
18 | 19 | let log = StringBuilder::new() |
19 | 20 | @async.with_task_group(fn(root) { |
20 | 21 | root.spawn_bg(fn() { |
@@ -62,7 +63,8 @@ async test "protect_from_cancel" { |
62 | 63 |
|
63 | 64 | ///| |
64 | 65 | async test "protect_from_cancel wait" { |
65 | | - random_delay() |
| 66 | + rate_limit.acquire() |
| 67 | + defer rate_limit.release() |
66 | 68 | let log = StringBuilder::new() |
67 | 69 | log.write_object( |
68 | 70 | try? @async.with_task_group(fn(root) { |
@@ -105,7 +107,8 @@ async test "protect_from_cancel wait" { |
105 | 107 |
|
106 | 108 | ///| |
107 | 109 | async test "protect_from_cancel with_timeout" { |
108 | | - random_delay() |
| 110 | + rate_limit.acquire() |
| 111 | + defer rate_limit.release() |
109 | 112 | let log = StringBuilder::new() |
110 | 113 | @async.with_task_group(fn(root) { |
111 | 114 | root.spawn_bg(fn() { |
@@ -137,7 +140,8 @@ async test "protect_from_cancel with_timeout" { |
137 | 140 |
|
138 | 141 | ///| |
139 | 142 | async test "protect_from_cancel fail" { |
140 | | - random_delay() |
| 143 | + rate_limit.acquire() |
| 144 | + defer rate_limit.release() |
141 | 145 | let log = StringBuilder::new() |
142 | 146 | log.write_object( |
143 | 147 | try? @async.with_task_group(fn(root) { |
@@ -169,7 +173,8 @@ async test "protect_from_cancel fail" { |
169 | 173 |
|
170 | 174 | ///| |
171 | 175 | async test "protect_from_cancel nested1" { |
172 | | - random_delay() |
| 176 | + rate_limit.acquire() |
| 177 | + defer rate_limit.release() |
173 | 178 | let log = StringBuilder::new() |
174 | 179 | @async.with_task_group(fn(root) { |
175 | 180 | root.spawn_bg(fn() { |
@@ -203,7 +208,8 @@ async test "protect_from_cancel nested1" { |
203 | 208 |
|
204 | 209 | ///| |
205 | 210 | async test "protect_from_cancel nested2" { |
206 | | - random_delay() |
| 211 | + rate_limit.acquire() |
| 212 | + defer rate_limit.release() |
207 | 213 | let log = StringBuilder::new() |
208 | 214 | @async.with_task_group(fn(root) { |
209 | 215 | root.spawn_bg(fn() { |
@@ -243,7 +249,8 @@ async test "protect_from_cancel nested2" { |
243 | 249 |
|
244 | 250 | ///| |
245 | 251 | async test "protect_from_cancel in cancellation handler" { |
246 | | - random_delay() |
| 252 | + rate_limit.acquire() |
| 253 | + defer rate_limit.release() |
247 | 254 | let log = StringBuilder::new() |
248 | 255 | log.write_object( |
249 | 256 | try? @async.with_task_group(fn(root) { |
@@ -276,7 +283,8 @@ async test "protect_from_cancel in cancellation handler" { |
276 | 283 |
|
277 | 284 | ///| |
278 | 285 | async test "cancel while scheduled" { |
279 | | - random_delay() |
| 286 | + rate_limit.acquire() |
| 287 | + defer rate_limit.release() |
280 | 288 | let log = StringBuilder::new() |
281 | 289 | @async.with_task_group(fn(root) { |
282 | 290 | root.spawn_bg(fn() { |
@@ -320,7 +328,8 @@ async test "cancel while scheduled" { |
320 | 328 |
|
321 | 329 | ///| |
322 | 330 | async test "error in async cancel" { |
323 | | - random_delay() |
| 331 | + rate_limit.acquire() |
| 332 | + defer rate_limit.release() |
324 | 333 | let log = StringBuilder::new() |
325 | 334 | @async.with_task_group(fn(root) { |
326 | 335 | root.spawn_bg(fn() { |
|
0 commit comments