1
0
Fork 0

Check if buffer is empty _before_ rebuilding it

This commit is contained in:
Gregory Eremin 2014-10-05 02:52:30 +04:00
parent 9d4e937aef
commit 49e0fc5a05
1 changed files with 4 additions and 4 deletions

View File

@ -57,15 +57,15 @@ func (b *Buffer) Add(series ...*influxdb.Series) {
// Flushes aggregated series into database
func (b *Buffer) Flush() {
if len(b.series) == 0 {
return
}
sbuffer := []*influxdb.Series{}
for _, item := range b.series {
sbuffer = append(sbuffer, item)
}
if len(sbuffer) == 0 {
return
}
b.fn(sbuffer)
b.Clear()
}