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 }