fixed performance issue
This commit is contained in:
@@ -110,7 +110,8 @@ func (c *Client) pullDeltas() []Delta {
|
|||||||
maxSize = 50
|
maxSize = 50
|
||||||
}
|
}
|
||||||
|
|
||||||
timeout := 10 * time.Microsecond
|
var timer <-chan time.Time
|
||||||
|
const timeout = 200 * time.Microsecond
|
||||||
|
|
||||||
var ds []Delta
|
var ds []Delta
|
||||||
for {
|
for {
|
||||||
@@ -119,10 +120,12 @@ func (c *Client) pullDeltas() []Delta {
|
|||||||
|
|
||||||
select {
|
select {
|
||||||
case d, ok = <-c.ch:
|
case d, ok = <-c.ch:
|
||||||
case <-time.After(timeout):
|
case <-timer:
|
||||||
return ds
|
return ds
|
||||||
}
|
}
|
||||||
|
|
||||||
|
timer = time.After(timeout)
|
||||||
|
|
||||||
if !ok {
|
if !ok {
|
||||||
return ds
|
return ds
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user