Skip to content

Commit 3b8d39f

Browse files
committed
Benchmark should not panic on server close
1 parent 3c71104 commit 3b8d39f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

async-nats/benches/core_nats.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,12 @@ pub fn subscribe(c: &mut Criterion) {
8282
let msg = &bmsg[0..*size].to_vec();
8383

8484
loop {
85-
nc.publish("bench".to_string(), msg.clone().into())
86-
.await
87-
.unwrap();
85+
let result = nc.publish("bench".to_string(), msg.clone().into())
86+
.await;
87+
88+
if result.is_err() {
89+
break
90+
}
8891
}
8992
}
9093
});

0 commit comments

Comments
 (0)