Release buffer back to pool earlier

This commit is contained in:
Daniel Nelson 2017-10-05 12:12:14 -07:00
parent b9f319529f
commit 4fab572b6b
No known key found for this signature in database
GPG Key ID: CAAD59C9444F6155
1 changed files with 1 additions and 1 deletions

View File

@ -427,13 +427,13 @@ func (s *Statsd) parser() error {
return nil
case buf := <-s.in:
lines := strings.Split(buf.String(), "\n")
s.bufPool.Put(buf)
for _, line := range lines {
line = strings.TrimSpace(line)
if line != "" {
s.parseStatsdLine(line)
}
}
s.bufPool.Put(buf)
}
}
}