Skip to content

Commit

Permalink
feat: Moves deletion of expired messages to run at all states
Browse files Browse the repository at this point in the history
Process expiration of messages in all states removing messages from the
outbox even in disconnected scenarios.

Closes #278
  • Loading branch information
euripedesrocha committed May 27, 2024
1 parent bed1207 commit 32dada4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mqtt_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -1589,6 +1589,8 @@ static void esp_mqtt_task(void *pv)
while (client->run) {
MQTT_API_LOCK(client);
run_event_loop(client);
// delete long pending messages
mqtt_delete_expired_messages(client);
mqtt_client_state_t state = client->state;
switch (state) {
case MQTT_STATE_DISCONNECTED:
Expand Down Expand Up @@ -1668,8 +1670,6 @@ static void esp_mqtt_task(void *pv)
last_retransmit = platform_tick_get_ms();
}

// delete long pending messages
mqtt_delete_expired_messages(client);

// resend all non-transmitted messages first
outbox_item_handle_t item = outbox_dequeue(client->outbox, QUEUED, NULL);
Expand Down

0 comments on commit 32dada4

Please sign in to comment.