From 31aed435cc583cee430b05f41567ccefff5fca09 Mon Sep 17 00:00:00 2001 From: Julian Brost Date: Mon, 31 May 2021 14:48:15 +0200 Subject: [PATCH] HA: context used to start transaction must not be canceled before the transaction is committed This was introduced by 621c1b953737a8983ba9701da8f01fc5426000c3 and leads to tx.Commit() always returning an "context canceled" error. --- pkg/icingadb/ha.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/icingadb/ha.go b/pkg/icingadb/ha.go index e6b05ba3..594a93bc 100644 --- a/pkg/icingadb/ha.go +++ b/pkg/icingadb/ha.go @@ -233,14 +233,15 @@ func (h *HA) realize(s *icingaredisv1.IcingaStatus, t *types.UnixMilli, shouldLo } } - cancel() - if err := tx.Commit(); err != nil { + cancel() return err } if takeover { h.signalTakeover() } + + cancel() break }