mirror of
https://github.com/Icinga/icingadb.git
synced 2026-06-06 23:32:14 -04:00
parent
47bc17f7d8
commit
5a146645f2
1 changed files with 4 additions and 4 deletions
|
|
@ -68,7 +68,7 @@ func (h *HA) Close() error {
|
|||
// Wait until the controller loop ended.
|
||||
<-h.Done()
|
||||
// Remove our instance from the database.
|
||||
h.removeInstance()
|
||||
h.removeInstance(context.Background())
|
||||
// And return an error, if any.
|
||||
return h.Err()
|
||||
}
|
||||
|
|
@ -259,11 +259,11 @@ func (h *HA) realize(s *icingaredisv1.IcingaStatus, t *types.UnixMilli, shouldLo
|
|||
return nil
|
||||
}
|
||||
|
||||
func (h *HA) removeInstance() {
|
||||
func (h *HA) removeInstance(ctx context.Context) {
|
||||
h.logger.Debugw("Removing our row from icingadb_instance", zap.String("instance_id", hex.EncodeToString(h.instanceId)))
|
||||
// Intentionally not using a context here as this is a cleanup task and h.ctx is already cancelled.
|
||||
// Intentionally not using h.ctx here as it's already cancelled.
|
||||
query := "DELETE FROM icingadb_instance WHERE id = ?"
|
||||
_, err := h.db.Exec(query, h.instanceId)
|
||||
_, err := h.db.ExecContext(ctx, query, h.instanceId)
|
||||
if err != nil {
|
||||
h.logger.Warnw("Could not remove instance from database", zap.Error(err), zap.String("query", query))
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue