mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
server: clear proposal wait in time
This commit is contained in:
@@ -298,6 +298,7 @@ func (s *Server) runParticipant() {
|
||||
recv := s.t.recv
|
||||
ticker := time.NewTicker(s.tickDuration)
|
||||
v2SyncTicker := time.NewTicker(time.Millisecond * 500)
|
||||
defer node.StopProposalWaiters()
|
||||
|
||||
var proposal chan v2Proposal
|
||||
var addNodeC, removeNodeC chan raft.Config
|
||||
|
||||
@@ -50,7 +50,8 @@ func (s *Server) v2apply(index int64, ent raft.Entry) {
|
||||
}
|
||||
}
|
||||
|
||||
if s.node.result[wait{index, ent.Term}] == nil {
|
||||
w := wait{index, ent.Term}
|
||||
if s.node.result[w] == nil {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -59,5 +60,6 @@ func (s *Server) v2apply(index int64, ent raft.Entry) {
|
||||
} else {
|
||||
ret = e
|
||||
}
|
||||
s.node.result[wait{index, ent.Term}] <- ret
|
||||
s.node.result[w] <- ret
|
||||
delete(s.node.result, w)
|
||||
}
|
||||
|
||||
@@ -45,3 +45,10 @@ func (r *v2Raft) Sync() {
|
||||
}
|
||||
r.Node.Propose(data)
|
||||
}
|
||||
|
||||
func (r *v2Raft) StopProposalWaiters() {
|
||||
for k, ch := range r.result {
|
||||
ch <- fmt.Errorf("server is stopped or removed from participant")
|
||||
delete(r.result, k)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user