Fix panic on influx shutdown.

Influx was shutdown before Poseidon was terminated. In that mean time the Profiling data has been written. Also in that mean time, a periodical influx event triggers a panic since influx is already shutdown.

We implemented two changes, each fixing this scenario.
This commit is contained in:
Maximilian Paß
2023-03-11 21:33:50 +00:00
committed by Sebastian Serth
parent 5fe9b686c2
commit a4599f2cf9
2 changed files with 5 additions and 4 deletions

View File

@ -82,6 +82,7 @@ func InitializeInfluxDB(db *config.InfluxDB) (cancel func()) {
// Flush the influx client on shutdown.
cancel = func() {
influxClient.Flush()
influxClient = nil
client.Close()
}
return cancel
@ -149,7 +150,7 @@ func ChangedPrewarmingPoolSize(id dto.EnvironmentID, count uint) {
WriteInfluxPoint(p)
}
// WriteInfluxPoint schedules the indlux data point to be sent.
// WriteInfluxPoint schedules the influx data point to be sent.
func WriteInfluxPoint(p *write.Point) {
if influxClient != nil {
p.AddTag("stage", config.Config.InfluxDB.Stage)