Check if buffer is empty _before_ rebuilding it
This commit is contained in:
		
							parent
							
								
									9d4e937aef
								
							
						
					
					
						commit
						49e0fc5a05
					
				| @ -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() | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user