enhance(mqtt): improve QoS handling and retry logic in MQTTBridge
Refactor the MQTTBridge to implement enhanced QoS handling for publish operations. Introduce retry mechanisms for QoS0 packets, allowing for transient failures to be retried with a delay. Update publish methods to return success status, improving error handling and logging. Additionally, adjust the packet queue processing to accommodate new retry logic and ensure better message delivery control.
This commit is contained in:
1 parent
9cfaaeba82
commit
7d0c5bce50
4 files changed
+174
-26
No files matched your search
@@ -471,7 +471,11 @@ int PsychicMqttClient::publish(const char *topic, int qos, bool retain, const ch
|
||||
if (async)
|
||||
{
|
||||
ESP_LOGV(TAG, "Enqueuing message to topic %s with QoS %d", topic, qos);
|
||||
return esp_mqtt_client_enqueue(_client, topic, payload, length, qos, retain, true);
|
||||
// QoS0 telemetry is high-rate and does not need durable outbox storage.
|
||||
// Avoiding store=true reduces small allocation churn in reconnect storms.
|
||||
// Keep store=true for QoS1/2 so status/control semantics remain durable.
|
||||
bool store_in_outbox = (qos > 0);
|
||||
return esp_mqtt_client_enqueue(_client, topic, payload, length, qos, retain, store_in_outbox);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user