Skip to content

Commit

Permalink
fixed: switched queue implementation details
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Peterson <[email protected]>
  • Loading branch information
mattp-swirldslabs committed Jun 27, 2024
1 parent 6ff6a8d commit 1e3386e
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.hedera.block.server.persistence.storage.BlockStorage;

import java.util.ArrayDeque;
import java.util.LinkedList;
import java.util.Optional;
import java.util.Queue;

Expand Down Expand Up @@ -63,13 +64,13 @@ public Long persist(final BlockStreamServiceGrpcProto.Block block) {
*/
@Override
public Queue<BlockStreamServiceGrpcProto.Block> readRange(final long startBlockId, final long endBlockId) {
final Queue<BlockStreamServiceGrpcProto.Block> blocks = new ArrayDeque<>();
final Queue<BlockStreamServiceGrpcProto.Block> blocks = new LinkedList<>();

long count = startBlockId;
Optional<BlockStreamServiceGrpcProto.Block> blockOpt = read(count);
while (count <= endBlockId && blockOpt.isPresent()) {
final BlockStreamServiceGrpcProto.Block block = blockOpt.get();
blocks.offer(block);
blocks.add(block);
blockOpt = read(++count);
}

Expand Down

0 comments on commit 1e3386e

Please sign in to comment.