Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions src/runtime/nodes/mqtt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -471,11 +471,17 @@ impl Node for MqttOutNode {
status("error", "no_topic", Value::Null);
continue;
};
if let Err(e) = shared
.publish(&topic, self.qos, self.retain, value_to_bytes(&msg.payload))
.await
{
status("error", "publish_error", json!({ "error": e }));
// A publish blocks when the broker is down (the client's
// request queue fills). Race it against shutdown so Stop
// still works — otherwise the node is aborted before it
// can release the shared connection (driver leak).
tokio::select! {
_ = NodeCtx::shutdown_requested(&mut shutdown) => break,
r = shared.publish(&topic, self.qos, self.retain, value_to_bytes(&msg.payload)) => {
if let Err(e) = r {
status("error", "publish_error", json!({ "error": e }));
}
}
}
}
None => break,
Expand Down