Skip to content

Commit

Permalink
Update DatabaseMessageSender.java
Browse files Browse the repository at this point in the history
fix bug for log; adjust the order of object creation to avoid creating useless objects
  • Loading branch information
jiangcaijun authored Jul 4, 2020
1 parent b901961 commit ff415a1
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public DatabaseMessageSender(final ReleaseMessageRepository releaseMessageReposi
public void sendMessage(String message, String channel) {
logger.info("Sending message {} to channel {}", message, channel);
if (!Objects.equals(channel, Topics.APOLLO_RELEASE_TOPIC)) {
logger.warn("Channel {} not supported by DatabaseMessageSender!");
logger.warn("Channel {} not supported by DatabaseMessageSender!", channel);
return;
}

Expand Down Expand Up @@ -82,12 +82,12 @@ private void initialize() {
}

private void cleanMessage(Long id) {
boolean hasMore = true;
//double check in case the release message is rolled back
ReleaseMessage releaseMessage = releaseMessageRepository.findById(id).orElse(null);
if (releaseMessage == null) {
return;
}
boolean hasMore = true;
while (hasMore && !Thread.currentThread().isInterrupted()) {
List<ReleaseMessage> messages = releaseMessageRepository.findFirst100ByMessageAndIdLessThanOrderByIdAsc(
releaseMessage.getMessage(), releaseMessage.getId());
Expand Down

0 comments on commit ff415a1

Please sign in to comment.