close the rcmgr on shutdown
This commit is contained in:
parent
325a4c0e5b
commit
73ec10a49e
@ -1,6 +1,7 @@
|
|||||||
package lp2p
|
package lp2p
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"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)
|
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
|
return mgr, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user