vspd: Exit if shutdown requested during startup.
vspd runs some tasks on startup - database consistency checks, catching up with missed blocks, etc. If a shutdown is requested while these tasks are running, vspd should stop immediately rather than continuing to start the web API server and other background tasks.
This commit is contained in:
parent
b5909817e4
commit
b0f79e56f5
@ -126,14 +126,29 @@ func (v *vspd) run() int {
|
||||
v.log.Errorf("Database integrity check failed: %v", err)
|
||||
}
|
||||
|
||||
// Stop if shutdown requested.
|
||||
if ctx.Err() != nil {
|
||||
return 0
|
||||
}
|
||||
|
||||
// Run the block connected handler now to catch up with any blocks mined
|
||||
// while vspd was shut down.
|
||||
v.blockConnected()
|
||||
|
||||
// Stop if shutdown requested.
|
||||
if ctx.Err() != nil {
|
||||
return 0
|
||||
}
|
||||
|
||||
// Run voting wallet consistency check now to ensure all wallets are up to
|
||||
// date.
|
||||
v.checkWalletConsistency()
|
||||
|
||||
// Stop if shutdown requested.
|
||||
if ctx.Err() != nil {
|
||||
return 0
|
||||
}
|
||||
|
||||
// WaitGroup for services to signal when they have shutdown cleanly.
|
||||
var shutdownWg sync.WaitGroup
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user