Browse Source

server: use buffer for proposal channel

Yicheng Qin 11 years ago
parent
commit
984f309815
1 changed files with 3 additions and 1 deletions
  1. 3 1
      etcd/etcd.go

+ 3 - 1
etcd/etcd.go

@@ -19,6 +19,8 @@ const (
 	defaultHeartbeat = 1
 	defaultElection  = 5
 
+	maxBufferedProposal = 128
+
 	defaultTickDuration = time.Millisecond * 100
 
 	v2machineKVPrefix = "/_etcd/machines"
@@ -94,7 +96,7 @@ func New(c *config.Config, id int64) *Server {
 		raftPubAddr:  c.Peer.Addr,
 		nodes:        make(map[string]bool),
 		tickDuration: defaultTickDuration,
-		proposal:     make(chan v2Proposal),
+		proposal:     make(chan v2Proposal, maxBufferedProposal),
 		node: &v2Raft{
 			Node:   raft.New(id, defaultHeartbeat, defaultElection),
 			result: make(map[wait]chan interface{}),