espressif / esp-mqtt

ESP32 mqtt component
Apache License 2.0
603 stars 255 forks source link

mqtt: Add esp_mqtt_client_get_outbox_size API #178

Closed AxelLin closed 3 years ago

AxelLin commented 3 years ago

Allow application to get current outbox_size. Application may try to send many publish request for a long period and then system can hit OOM when publish QoS>1 with a busy borker. Reduce OUTBOX_EXPIRED_TIMEOUT_MS does not help too much because the publish freauency depends on the data received in different environment. i.e. In some environment, sometimes it's easy to hit OOM before reaching OUTBOX_EXPIRED_TIMEOUT_MS.

To avoid such issue, add esp_mqtt_client_get_outbox_size API, so the application can stop publishing to avoid OOM when outbox takes too much memory.

Signed-off-by: Axel Lin axel.lin@ingics.com