From 3649b367e123fe4053fd39b4a906c21198aea143 Mon Sep 17 00:00:00 2001 From: Julian Brost Date: Mon, 3 May 2021 13:19:18 +0200 Subject: [PATCH] Handle HA errors --- cmd/icingadb/main.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cmd/icingadb/main.go b/cmd/icingadb/main.go index b3927f70..d6baa096 100644 --- a/cmd/icingadb/main.go +++ b/cmd/icingadb/main.go @@ -95,6 +95,15 @@ func main() { cancelHactx() case <-hactx.Done(): // Nothing to do here, surrounding loop will terminate now. + case <-ha.Done(): + if err := ha.Err(); err != nil { + panic(errors.Wrap(err, "HA exited with an error")) + } else if ctx.Err() == nil { + // ha is created as a single instance once. It should only exit if the main context is cancelled, + // otherwise there is no way to get Icinga DB back into a working state. + panic(errors.New("HA exited without an error but main context isn't cancelled")) + } + return case <-ctx.Done(): return case s := <-sig: