mirror of
https://github.com/Icinga/icingadb.git
synced 2026-06-06 15:22:08 -04:00
parent
5a146645f2
commit
ea7668d99a
2 changed files with 4 additions and 4 deletions
|
|
@ -69,7 +69,7 @@ func run() int {
|
|||
ha := icingadb.NewHA(ctx, db, heartbeat, logger)
|
||||
// Closing ha on exit ensures that this instance retracts its heartbeat
|
||||
// from the database so that another instance can take over immediately.
|
||||
defer ha.Close()
|
||||
defer ha.Close(context.Background())
|
||||
s := icingadb.NewSync(db, rc, logger)
|
||||
hs := history.NewSync(db, rc, logger)
|
||||
rt := icingadb.NewRuntimeUpdates(db, rc, logger)
|
||||
|
|
|
|||
|
|
@ -61,14 +61,14 @@ func NewHA(ctx context.Context, db *DB, heartbeat *icingaredis.Heartbeat, logger
|
|||
return ha
|
||||
}
|
||||
|
||||
// Close implements the io.Closer interface.
|
||||
func (h *HA) Close() error {
|
||||
// Close shuts h down.
|
||||
func (h *HA) Close(ctx context.Context) error {
|
||||
// Cancel ctx.
|
||||
h.cancelCtx()
|
||||
// Wait until the controller loop ended.
|
||||
<-h.Done()
|
||||
// Remove our instance from the database.
|
||||
h.removeInstance(context.Background())
|
||||
h.removeInstance(ctx)
|
||||
// And return an error, if any.
|
||||
return h.Err()
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue