Decouple InfluxDB writings from request handling.

With #451, we found that writing an InfluxDB data point might block and lead to high latencies.
This commit is contained in:
Maximilian Paß
2024-01-26 22:46:00 +01:00
committed by Sebastian Serth
parent ae86b1c261
commit 08c3a3d53d

View File

@ -164,7 +164,8 @@ func ChangedPrewarmingPoolSize(id dto.EnvironmentID, count uint) {
func WriteInfluxPoint(p *write.Point) {
if influxClient != nil {
p.AddTag("stage", config.Config.InfluxDB.Stage)
influxClient.WritePoint(p)
// We identified that the influxClient is not truly asynchronous. See #541.
go func() { influxClient.WritePoint(p) }()
} else {
entry := log.WithField("name", p.Name())
for _, tag := range p.TagList() {