server: better way to clean chainControl resources
In this commit the location of where chain control services are stopped is shifted to be closer to the point they are started. Stopping of two services: "wallet" and "feeEstimator" that are started inside the "newChainControlFromConfig" was shifted from server.go to the cleanup function. In addition the chainView.Stop was also removed from the server.Stop as it is already handled by the router, where it is being started.
This commit is contained in:
1 parent
becae748de
commit
65ab3dbfc8
2 files changed
+45
-29
No files matched your search
@@ -545,7 +545,10 @@ func Main(cfg *Config, lisCfg ListenerCfg, interceptor signal.Interceptor) error
|
||||
FeeURL: cfg.FeeURL,
|
||||
}
|
||||
|
||||
activeChainControl, err := chainreg.NewChainControl(chainControlCfg)
|
||||
activeChainControl, cleanup, err := chainreg.NewChainControl(chainControlCfg)
|
||||
if cleanup != nil {
|
||||
defer cleanup()
|
||||
}
|
||||
if err != nil {
|
||||
err := fmt.Errorf("unable to create chain control: %v", err)
|
||||
ltndLog.Error(err)
|
||||
|
||||
Reference in new issue
Block a user