File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -4,12 +4,15 @@ import (
44 "fmt"
55 "sort"
66 "strings"
7+ "sync"
78 "time"
89
910 "github.com/influxdb/influxdb/client"
1011)
1112
1213type BatchPoints struct {
14+ mu sync.Mutex
15+
1316 client.BatchPoints
1417
1518 Debug bool
@@ -20,6 +23,9 @@ type BatchPoints struct {
2023}
2124
2225func (bp * BatchPoints ) Add (measurement string , val interface {}, tags map [string ]string ) {
26+ bp .mu .Lock ()
27+ defer bp .mu .Unlock ()
28+
2329 measurement = bp .Prefix + measurement
2430
2531 if bp .Config != nil {
@@ -55,6 +61,9 @@ func (bp *BatchPoints) AddValuesWithTime(
5561 tags map [string ]string ,
5662 timestamp time.Time ,
5763) {
64+ bp .mu .Lock ()
65+ defer bp .mu .Unlock ()
66+
5867 measurement = bp .Prefix + measurement
5968
6069 if bp .Config != nil {
You can’t perform that action at this time.
0 commit comments