Skip to content

Commit

Permalink
periodically emit last block produced if no pre no preBlock published
Browse files Browse the repository at this point in the history
  • Loading branch information
Hellblazer committed May 26, 2024
1 parent 5081560 commit 526ab5d
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions choam/src/main/java/com/salesforce/apollo/choam/Producer.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -258,13 +255,13 @@ private void processTransactions(boolean last, List<UnitData> 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(),
Expand Down

0 comments on commit 526ab5d

Please sign in to comment.