Skip to content

Commit

Permalink
Optimize getActiveLedgersInRange (#4005)
Browse files Browse the repository at this point in the history
* Optimize getActiveLedgersInRange
  • Loading branch information
AnonHxy committed Jul 10, 2023
1 parent 528f373 commit c967299
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ public void delete(long ledgerId) throws IOException {

public Iterable<Long> getActiveLedgersInRange(final long firstLedgerId, final long lastLedgerId)
throws IOException {
if (firstLedgerId <= 0 && lastLedgerId == Long.MAX_VALUE) {
return ledgers.keys();
}
return Iterables.filter(ledgers.keys(), new Predicate<Long>() {
@Override
public boolean apply(Long ledgerId) {
Expand Down

0 comments on commit c967299

Please sign in to comment.