From 73ec10a49ea6f80b338ada16c16a089f40f645d6 Mon Sep 17 00:00:00 2001 From: vyzo Date: Thu, 20 Jan 2022 11:47:39 +0200 Subject: [PATCH] close the rcmgr on shutdown --- node/modules/lp2p/rcmgr.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/node/modules/lp2p/rcmgr.go b/node/modules/lp2p/rcmgr.go index df52b4a4f..8b286ff5e 100644 --- a/node/modules/lp2p/rcmgr.go +++ b/node/modules/lp2p/rcmgr.go @@ -1,6 +1,7 @@ package lp2p import ( + "context" "errors" "fmt" "os" @@ -56,6 +57,11 @@ func ResourceManager(lc fx.Lifecycle, repo repo.LockedRepo) (network.ResourceMan return nil, fmt.Errorf("error creating resource manager: %w", err) } + lc.Append(fx.Hook{ + OnStop: func(_ context.Context) error { + return mgr.Close() + }}) + return mgr, nil }