mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-21 07:24:36 +00:00
p2p: reduce buffering on channels (#6609)
Having smaller buffers in each reactor/channel will mean that there will be fewer stale messages.
This commit is contained in:
@@ -51,8 +51,8 @@ func ChannelDescriptor() conn.ChannelDescriptor {
|
||||
Priority: 1,
|
||||
SendQueueCapacity: 10,
|
||||
RecvMessageCapacity: maxMsgSize,
|
||||
|
||||
MaxSendBytes: 200,
|
||||
RecvBufferCapacity: 32,
|
||||
MaxSendBytes: 200,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -417,6 +417,7 @@ func (r *ReactorV2) sendRequestForPeers() {
|
||||
// no peers are available
|
||||
r.Logger.Debug("no available peers to send request to, waiting...")
|
||||
r.nextRequestTime = time.Now().Add(noAvailablePeersWaitPeriod)
|
||||
|
||||
return
|
||||
}
|
||||
var peerID types.NodeID
|
||||
|
||||
@@ -19,7 +19,7 @@ import (
|
||||
"github.com/tendermint/tendermint/types"
|
||||
)
|
||||
|
||||
const queueBufferDefault = 4096
|
||||
const queueBufferDefault = 32
|
||||
|
||||
// ChannelID is an arbitrary channel ID.
|
||||
type ChannelID uint16
|
||||
@@ -365,10 +365,6 @@ func (r *Router) createQueueFactory() (func(int) queue, error) {
|
||||
// wrapper message. The caller may provide a size to make the channel buffered,
|
||||
// which internally makes the inbound, outbound, and error channel buffered.
|
||||
func (r *Router) OpenChannel(chDesc ChannelDescriptor, messageType proto.Message, size int) (*Channel, error) {
|
||||
if size == 0 {
|
||||
size = queueBufferDefault
|
||||
}
|
||||
|
||||
r.channelMtx.Lock()
|
||||
defer r.channelMtx.Unlock()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user