Skip to content

Commit f653cfd

Browse files
committed
feat(event): optimize event service log
1 parent f9a4544 commit f653cfd

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

framework/src/main/java/org/tron/core/services/event/BlockEventCache.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ public static void init(BlockCapsule.BlockId blockId) {
4343
}
4444

4545
public static void add(BlockEvent blockEvent) throws EventException {
46-
logger.info("Add block event, {}, {}", blockEvent.getBlockId().getString(),
47-
blockEvent.getParentId().getString());
46+
logger.info("Add block event, {}, {}, {}", blockEvent.getBlockId().getString(),
47+
blockEvent.getParentId().getString(), blockEvent.getSolidId().getString());
4848
if (blockEventMap.get(blockEvent.getParentId()) == null) {
4949
throw new EventException("unlink BlockEvent, "
5050
+ blockEvent.getBlockId().getString() + ", "
@@ -83,6 +83,7 @@ public static void remove(BlockCapsule.BlockId solidId) {
8383
}
8484

8585
public static List<BlockEvent> getSolidBlockEvents(BlockCapsule.BlockId solidId) {
86+
logger.info("Get solid events {}, {}", solidNum, solidId);
8687
List<BlockEvent> blockEvents = new ArrayList<>();
8788
BlockCapsule.BlockId tmp = solidId;
8889
while (tmp.getNum() > solidNum) {

framework/src/main/java/org/tron/core/services/event/SolidEventService.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,14 @@ public void work() {
4747
return;
4848
}
4949

50-
List<BlockEvent> blockEvents = BlockEventCache.getSolidBlockEvents(solidId);
50+
List<BlockEvent> blockEvents;
51+
52+
try {
53+
blockEvents = BlockEventCache.getSolidBlockEvents(solidId);
54+
} catch (Exception e) {
55+
logger.warn("Get solid events failed. {}", e.getMessage());
56+
return;
57+
}
5158

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

0 commit comments

Comments
 (0)