mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
commit
6b3fa6aa72
@ -136,6 +136,7 @@ func (cw *streamWriter) run() {
|
|||||||
t streamType
|
t streamType
|
||||||
enc encoder
|
enc encoder
|
||||||
flusher http.Flusher
|
flusher http.Flusher
|
||||||
|
batched int
|
||||||
)
|
)
|
||||||
tickc := time.Tick(ConnReadTimeout / 3)
|
tickc := time.Tick(ConnReadTimeout / 3)
|
||||||
|
|
||||||
@ -146,6 +147,7 @@ func (cw *streamWriter) run() {
|
|||||||
err := enc.encode(linkHeartbeatMessage)
|
err := enc.encode(linkHeartbeatMessage)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
flusher.Flush()
|
flusher.Flush()
|
||||||
|
batched = 0
|
||||||
reportSentDuration(string(t), linkHeartbeatMessage, time.Since(start))
|
reportSentDuration(string(t), linkHeartbeatMessage, time.Since(start))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@ -159,7 +161,13 @@ func (cw *streamWriter) run() {
|
|||||||
start := time.Now()
|
start := time.Now()
|
||||||
err := enc.encode(m)
|
err := enc.encode(m)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
flusher.Flush()
|
if len(msgc) == 0 || batched > streamBufSize/2 {
|
||||||
|
flusher.Flush()
|
||||||
|
batched = 0
|
||||||
|
} else {
|
||||||
|
batched++
|
||||||
|
}
|
||||||
|
|
||||||
reportSentDuration(string(t), m, time.Since(start))
|
reportSentDuration(string(t), m, time.Since(start))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user