Skip to content

Commit 2a69115

Browse files
authored
fix(spool): remove message when retries run out (#1427)
1 parent 2d93f9d commit 2a69115

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/main/java/com/aws/greengrass/mqttclient/MqttClient.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,7 @@ protected CompletableFuture<Integer> publishSingleSpoolerMessage(AwsIotMqttClien
623623
logger.atError().log("Failed to publish the message via Spooler"
624624
+ " after retried {} times and will drop the message",
625625
maxPublishRetryCount, throwable);
626+
spool.removeMessageById(finalId);
626627
}
627628

628629
}

src/test/java/com/aws/greengrass/mqttclient/MqttClientTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,7 @@ void GIVEN_publish_request_unsuccessfully_WHEN_spool_single_message_THEN_not_ret
719719
client.publishSingleSpoolerMessage(awsIotMqttClient);
720720

721721
verify(awsIotMqttClient).publish(any(), any(), anyBoolean());
722-
verify(spool, never()).removeMessageById(anyLong());
722+
verify(spool, times(1)).removeMessageById(anyLong());
723723
verify(spool, never()).addId(anyLong());
724724
}
725725

0 commit comments

Comments
 (0)