Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ public static void init(BlockCapsule.BlockId blockId) {
}

public static void add(BlockEvent blockEvent) throws EventException {
logger.info("Add block event, {}, {}", blockEvent.getBlockId().getString(),
blockEvent.getParentId().getString());
logger.info("Add block event, {}, {}, {}", blockEvent.getBlockId().getString(),
blockEvent.getParentId().getString(), blockEvent.getSolidId().getString());
if (blockEventMap.get(blockEvent.getParentId()) == null) {
throw new EventException("unlink BlockEvent, "
+ blockEvent.getBlockId().getString() + ", "
Expand Down Expand Up @@ -83,6 +83,7 @@ public static void remove(BlockCapsule.BlockId solidId) {
}

public static List<BlockEvent> getSolidBlockEvents(BlockCapsule.BlockId solidId) {
logger.info("Get solid events {}, {}", solidNum, solidId);
List<BlockEvent> blockEvents = new ArrayList<>();
BlockCapsule.BlockId tmp = solidId;
while (tmp.getNum() > solidNum) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,14 @@ public void work() {
return;
}

List<BlockEvent> blockEvents = BlockEventCache.getSolidBlockEvents(solidId);
List<BlockEvent> blockEvents;

try {
blockEvents = BlockEventCache.getSolidBlockEvents(solidId);
} catch (Exception e) {
logger.warn("Get solid events failed. {}", e.getMessage());
return;
}

blockEvents.forEach(v -> flush(v));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public void test() throws Exception {
BlockCapsule.BlockId b1 = new BlockCapsule.BlockId(getBlockId(), 1);
be1.setBlockId(b1);
be1.setParentId(b1);
be1.setSolidId(b1);
try {
BlockEventCache.add(be1);
Assert.fail();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ public class SolidEventServiceTest {

@Test
public void test() throws Exception {
BlockEvent be0 = new BlockEvent();
BlockCapsule.BlockId b0 = new BlockCapsule.BlockId(BlockEventCacheTest.getBlockId(), 1);
be0.setBlockId(b0);
be0.setParentId(b0);
be0.setSolidId(new BlockCapsule.BlockId(BlockEventCacheTest.getBlockId(), 100));
BlockEventCache.init(b0);
BlockEventCache.add(be0);
solidEventService.work();

BlockEvent be1 = new BlockEvent();
BlockCapsule.BlockId b1 = new BlockCapsule.BlockId(BlockEventCacheTest.getBlockId(), 1);
be1.setBlockId(b1);
Expand Down