fix(db): return error directly

This commit is contained in:
2026-06-04 13:16:04 +02:00
parent 89023b86ac
commit f4ab3093c3

View File

@@ -68,17 +68,13 @@ func (g *InfluxGateway) AddDatapoint(dp datapoint.DataPointInfo) error {
),
)
// check if the number of point >= batchsize
// if not ready, we are done
if g.batcher.Ready() {
// Send batch to influx DB
err := g.Flush()
if err != nil {
return err
}
}
return nil
}
// If ready, flush and return the result directly
return g.Flush()
}
// Flush sends the current batch of points to InfluxDB.
@@ -86,11 +82,7 @@ func (g *InfluxGateway) Flush() error {
// Send batch to influx DB
err := g.client.WritePoints(context.Background(), g.batcher.Emit())
if err != nil {
return err
}
return nil
}
// Close closes the InfluxGateway client.