lnd: add interrupt handler to handle shutdown requests while syncing
chain backend
This commit is contained in:
3 files changed
+16
-14
No files matched your search
@@ -570,7 +570,20 @@ func lndMain() error {
|
||||
ltndLog.Infof("Waiting for chain backend to finish sync, "+
|
||||
"start_height=%v", bestHeight)
|
||||
|
||||
// We'll add an interrupt handler in order to process shutdown
|
||||
// requests while the chain backend syncs.
|
||||
addInterruptHandler(func() {
|
||||
rpcServer.Stop()
|
||||
fundingMgr.Stop()
|
||||
})
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-shutdownChannel:
|
||||
return nil
|
||||
default:
|
||||
}
|
||||
|
||||
synced, _, err := activeChainControl.wallet.IsSynced()
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -617,16 +630,12 @@ func lndMain() error {
|
||||
}
|
||||
|
||||
addInterruptHandler(func() {
|
||||
ltndLog.Infof("Gracefully shutting down the server...")
|
||||
rpcServer.Stop()
|
||||
fundingMgr.Stop()
|
||||
server.Stop()
|
||||
|
||||
if pilot != nil {
|
||||
pilot.Stop()
|
||||
}
|
||||
|
||||
server.WaitForShutdown()
|
||||
server.Stop()
|
||||
})
|
||||
|
||||
// Wait for shutdown signal from either a graceful server stop or from
|
||||
|
||||
Reference in new issue
Block a user