Skip to content

Commit

Permalink
simplified while loop
Browse files Browse the repository at this point in the history
Signed-off-by: Atanas Atanasov <[email protected]>
  • Loading branch information
ata-nas committed Jan 30, 2025
1 parent f9b8af4 commit c4d7a5a
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ private void handleBlockItems(final List<BlockItemUnparsed> blockItems)
if (blockItems.getLast().hasBlockProof()) {
currentWriterQueue = null;
}
Future<BlockPersistenceResult> completionResult = completionService.poll();
while (Objects.nonNull(completionResult)) {
Future<BlockPersistenceResult> completionResult;
while ((completionResult = completionService.poll()) != null) {
// @todo(545) is this loop really the best way to poll for the callables? Is there not a reactive way
// to do this?
try {
Expand All @@ -217,7 +217,6 @@ private void handleBlockItems(final List<BlockItemUnparsed> blockItems)
ackHandler.blockPersisted(blockNumber);
metricsService.get(BlocksPersisted).increment();
LOGGER.log(INFO, "Block [%s] persisted successfully.".formatted(blockNumber));
completionResult = completionService.poll();
} else {
// @todo(545) should we handle non successful statuses directly here?
}
Expand Down

0 comments on commit c4d7a5a

Please sign in to comment.