Handle expected case of empty flux in message deletion

This commit is contained in:
Chris Eager authored and Chris Eager committed 2022-10-31 12:29:25 -05:00
1 parent c10fda8363
commit aa829af43b
2 files changed
+15 -4

No files matched your search

@@ -175,9 +175,9 @@ public class MessagesDynamoDb extends AbstractDynamoDbStore {
}
return null;
})
.last()
.toFuture()
.thenApply(Optional::ofNullable);
.map(Optional::ofNullable)
.last(Optional.empty()) // if the flux is empty, last() will throw without a default
.toFuture();
}
public CompletableFuture<Optional<MessageProtos.Envelope>> deleteMessage(final UUID destinationAccountUuid,