From 526ab5d86b3019edd3c850f56efe30e4fa8641cf Mon Sep 17 00:00:00 2001 From: Hellblazer Date: Sat, 25 May 2024 17:21:15 -0700 Subject: [PATCH] periodically emit last block produced if no pre no preBlock published --- .../com/salesforce/apollo/choam/Producer.java | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/choam/src/main/java/com/salesforce/apollo/choam/Producer.java b/choam/src/main/java/com/salesforce/apollo/choam/Producer.java index c261fa49b..3728d7b22 100644 --- a/choam/src/main/java/com/salesforce/apollo/choam/Producer.java +++ b/choam/src/main/java/com/salesforce/apollo/choam/Producer.java @@ -27,10 +27,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; +import java.util.*; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ConcurrentSkipListMap; import java.util.concurrent.CopyOnWriteArrayList; @@ -258,13 +255,13 @@ private void processTransactions(boolean last, List aggregate) { final var txns = aggregate.stream().flatMap(e -> e.getTransactionsList().stream()).toList(); if (txns.isEmpty()) { - // if (preblocks % 5 == 0) { - // pending.values() - // .stream() - // .filter(pb -> pb.published.get()) - // .max(Comparator.comparing(pb -> pb.block.height())) - // .ifPresent(pb -> publish(pb, true)); - // } + if (preblocks % 5 == 0) { + pending.values() + .stream() + .filter(pb -> pb.published.get()) + .max(Comparator.comparing(pb -> pb.block.height())) + .ifPresent(pb -> publish(pb, true)); + } return; } log.trace("transactions: {} combined hash: {} height: {} on: {}", txns.size(),