From 17d282e877dff7270374e081bf554db65bd2e8c2 Mon Sep 17 00:00:00 2001 From: Chris Schinnerl Date: Tue, 13 Feb 2024 14:07:42 +0100 Subject: [PATCH] registry: make sure registry recorder is closed --- cmd/hostd/node.go | 1 + host/registry/registry.go | 6 +++++- internal/test/host.go | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cmd/hostd/node.go b/cmd/hostd/node.go index 50ab10d9..0158febd 100644 --- a/cmd/hostd/node.go +++ b/cmd/hostd/node.go @@ -55,6 +55,7 @@ func (n *node) Close() error { n.rhp3.Close() n.rhp2.Close() n.data.Close() + n.registry.Close() n.storage.Close() n.contracts.Close() n.w.Close() diff --git a/host/registry/registry.go b/host/registry/registry.go index 8f2bc009..261b0796 100644 --- a/host/registry/registry.go +++ b/host/registry/registry.go @@ -122,6 +122,10 @@ func NewManager(privkey types.PrivateKey, store Store, log *zap.Logger) *Manager log: log.Named("recorder"), }, } - go m.recorder.Run(m.tg.Done()) + done, _ := m.tg.Add() + go func() { + m.recorder.Run(m.tg.Done()) + done() + }() return m } diff --git a/internal/test/host.go b/internal/test/host.go index 1a91feac..c6f128ea 100644 --- a/internal/test/host.go +++ b/internal/test/host.go @@ -84,6 +84,7 @@ func (h *Host) Close() error { h.settings.Close() h.wallet.Close() h.contracts.Close() + h.registry.Close() h.storage.Close() h.store.Close() h.Node.Close()