Release buffer back to pool earlier
This commit is contained in:
parent
fe40bcb92e
commit
df4c24a01e
|
@ -427,13 +427,13 @@ func (s *Statsd) parser() error {
|
||||||
return nil
|
return nil
|
||||||
case buf := <-s.in:
|
case buf := <-s.in:
|
||||||
lines := strings.Split(buf.String(), "\n")
|
lines := strings.Split(buf.String(), "\n")
|
||||||
|
s.bufPool.Put(buf)
|
||||||
for _, line := range lines {
|
for _, line := range lines {
|
||||||
line = strings.TrimSpace(line)
|
line = strings.TrimSpace(line)
|
||||||
if line != "" {
|
if line != "" {
|
||||||
s.parseStatsdLine(line)
|
s.parseStatsdLine(line)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s.bufPool.Put(buf)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue