mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
peer: wait a little before closing idle connections
It seems that it needs some time to set connections that just used as idle.
This commit is contained in:
parent
611d564865
commit
069a288a59
@ -122,7 +122,7 @@ func (p *peer) post(d []byte) {
|
||||
buf := bytes.NewBuffer(d)
|
||||
resp, err := p.c.Post(p.url, "application/octet-stream", buf)
|
||||
if err != nil {
|
||||
log.Println("peer.post url=%s err=\"%v\"", p.url, err)
|
||||
log.Printf("peer.post url=%s err=\"%v\"", p.url, err)
|
||||
return
|
||||
}
|
||||
resp.Body.Close()
|
||||
|
@ -25,6 +25,7 @@ import (
|
||||
"net/url"
|
||||
"path"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/coreos/etcd/raft"
|
||||
)
|
||||
@ -77,6 +78,9 @@ func (h *peerHub) stop() {
|
||||
for _, p := range h.peers {
|
||||
p.stop()
|
||||
}
|
||||
// http.Transport needs some time to put used connections
|
||||
// into idle queues.
|
||||
time.Sleep(time.Millisecond)
|
||||
tr := h.c.Transport.(*http.Transport)
|
||||
tr.CloseIdleConnections()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user