Skip to content

Commit

Permalink
Do not execute sleep when 'pub_interval' is 0
Browse files Browse the repository at this point in the history
  • Loading branch information
rmqtt committed Jun 15, 2023
1 parent e367dbe commit d903050
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/v3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,9 @@ impl Client {
let qos = v3::codec::QoS::try_from(opts.qos).unwrap();

loop {
sleep(Duration::from_millis(opts.pub_interval)).await;
if opts.pub_interval > 0 {
sleep(Duration::from_millis(opts.pub_interval)).await;
}

let no = (rand::prelude::random::<u64>() % pub_topic_len) + no_start;
let pub_topic = ByteString::from(
Expand Down

0 comments on commit d903050

Please sign in to comment.