Skip to content

Commit 5c70710

Browse files
committed
Minified the code to check publish in event loop
Signed-off-by: Suneet Nangia <[email protected]>
1 parent 3c2803b commit 5c70710

File tree

1 file changed

+3
-16
lines changed
  • crates/outbound-mqtt/src

1 file changed

+3
-16
lines changed

crates/outbound-mqtt/src/lib.rs

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -98,28 +98,15 @@ impl v2::HostConnection for OutboundMqtt {
9898
.map_err(other_error)?;
9999

100100
// Poll event loop until outgoing publish event is iterated over to send the message to MQTT broker or capture/throw error.
101-
// We may revisit this later to manage long running connections and their issues in the connection pool.
101+
// We may revisit this later to manage long running connections, high throughput use cases and their issues in the connection pool.
102102
loop {
103103
let event = eventloop
104104
.poll()
105105
.await
106106
.map_err(|err| v2::Error::ConnectionFailed(err.to_string()))?;
107107

108-
match event {
109-
rumqttc::Event::Outgoing(outgoing_event) => {
110-
match outgoing_event {
111-
rumqttc::Outgoing::Publish(_) => {
112-
return Ok(());
113-
}
114-
_ => {
115-
// We don't care about other outgoing event types in this loop check.
116-
continue;
117-
}
118-
}
119-
}
120-
rumqttc::Event::Incoming(_) => {
121-
// We don't care about incoming event types in this loop check.
122-
}
108+
if let rumqttc::Event::Outgoing(rumqttc::Outgoing::Publish(_)) = event {
109+
return Ok(());
123110
}
124111
}
125112
}

0 commit comments

Comments
 (0)