File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -88,12 +88,24 @@ impl v2::HostConnection for OutboundMqtt {
88
88
qos : Qos ,
89
89
) -> Result < Result < ( ) , Error > > {
90
90
Ok ( async {
91
- let ( client, _ ) = self . get_conn ( connection) . await . map_err ( other_error) ?;
91
+ let ( client, eventloop ) = self . get_conn ( connection) . await . map_err ( other_error) ?;
92
92
let qos = convert_to_mqtt_qos_value ( qos) ;
93
+
94
+ // Message published to EventLoop (not MQTT Broker)
93
95
client
94
96
. publish_bytes ( topic, qos, false , payload. into ( ) )
95
97
. await
96
98
. map_err ( other_error) ?;
99
+
100
+ // Poll EventLoop once 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.
102
+ eventloop
103
+ . poll ( )
104
+ . await
105
+ . map_err ( |err : rumqttc:: ConnectionError | {
106
+ v2:: Error :: ConnectionFailed ( err. to_string ( ) )
107
+ } ) ?;
108
+
97
109
Ok ( ( ) )
98
110
}
99
111
. await )
You can’t perform that action at this time.
0 commit comments