add a timeout

This commit is contained in:
Chris Lu 2019-01-26 00:15:42 -06:00
parent 09471b46f9
commit 834f414af9

View file

@ -45,6 +45,7 @@ func NewRaftServer(r *mux.Router, peers []string, httpAddr string, dataDir strin
transporter := raft.NewHTTPTransporter("/cluster", time.Second) transporter := raft.NewHTTPTransporter("/cluster", time.Second)
transporter.Transport.MaxIdleConnsPerHost = 1024 transporter.Transport.MaxIdleConnsPerHost = 1024
transporter.Transport.IdleConnTimeout = time.Second transporter.Transport.IdleConnTimeout = time.Second
transporter.Transport.ResponseHeaderTimeout = time.Second
glog.V(0).Infof("Starting RaftServer with %v", httpAddr) glog.V(0).Infof("Starting RaftServer with %v", httpAddr)
// Clear old cluster configurations if peers are changed // Clear old cluster configurations if peers are changed