Skip to content

Commit 5ec01d4

Browse files
authored
Merge pull request #5012 from 317787106/hotfix/zmq_lock
feat(db): add timeout sending of zmq
2 parents c09446f + 14c1c80 commit 5ec01d4

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

framework/src/main/java/org/tron/common/logsfilter/nativequeue/NativeMessageQueue.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ public class NativeMessageQueue {
1111

1212
private static final int DEFAULT_BIND_PORT = 5555;
1313
private static final int DEFAULT_QUEUE_LENGTH = 1000;
14+
private static final int ZMQ_SEND_TIME_OUT = 1_000;
1415
private static NativeMessageQueue instance;
1516
private ZContext context = null;
1617
private ZMQ.Socket publisher = null;
@@ -33,7 +34,7 @@ public boolean start(int bindPort, int sendQueueLength) {
3334
if (Objects.isNull(publisher)) {
3435
return false;
3536
}
36-
37+
publisher.setSendTimeOut(ZMQ_SEND_TIME_OUT);
3738
if (bindPort == 0 || bindPort < 0) {
3839
bindPort = DEFAULT_BIND_PORT;
3940
}

framework/src/main/java/org/tron/core/net/P2pEventHandlerImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,10 +222,10 @@ private void processException(PeerConnection peer, TronMessage msg, Exception ex
222222
break;
223223
}
224224
if (type.equals(P2pException.TypeEnum.BAD_MESSAGE)) {
225-
logger.error("Message from {} process failed, {} \n type: {}",
225+
logger.error("Message from {} process failed, {} \n type: ({})",
226226
peer.getInetSocketAddress(), msg, type, ex);
227227
} else {
228-
logger.warn("Message from {} process failed, {} \n type: {}, detail: {}",
228+
logger.warn("Message from {} process failed, {} \n type: ({}), detail: {}",
229229
peer.getInetSocketAddress(), msg, type, ex.getMessage());
230230
}
231231
} else {

0 commit comments

Comments
 (0)