From 0ee76a307ff36a09ea389f316f2e0ddea3d2b9d1 Mon Sep 17 00:00:00 2001 From: Devdutt Shenoi Date: Tue, 22 Oct 2024 12:38:33 +0530 Subject: [PATCH] fix: unset `clean_session` NOTE: This ensures that no data is lost as a result of inflight being unacknowledged during a network failure/restart --- uplink/src/base/mqtt/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/uplink/src/base/mqtt/mod.rs b/uplink/src/base/mqtt/mod.rs index c172a029..6efa1591 100644 --- a/uplink/src/base/mqtt/mod.rs +++ b/uplink/src/base/mqtt/mod.rs @@ -297,6 +297,7 @@ fn mqttoptions(config: &Config, device_config: &DeviceConfig) -> MqttOptions { mqttoptions.set_max_packet_size(config.mqtt.max_packet_size, config.mqtt.max_packet_size); mqttoptions.set_keep_alive(Duration::from_secs(config.mqtt.keep_alive)); mqttoptions.set_inflight(config.mqtt.max_inflight); + mqttoptions.set_clean_session(false); if let Some(auth) = device_config.authentication.clone() { let ca = auth.ca_certificate.into_bytes();