From d90305079b927d391c03ffdc12eaf00dcd9badeb Mon Sep 17 00:00:00 2001 From: rmqtt Date: Thu, 15 Jun 2023 22:32:37 +0800 Subject: [PATCH] Do not execute sleep when 'pub_interval' is 0 --- src/v3.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/v3.rs b/src/v3.rs index 61d3315..de870b8 100644 --- a/src/v3.rs +++ b/src/v3.rs @@ -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::() % pub_topic_len) + no_start; let pub_topic = ByteString::from(