Shutdown the node program for sys interrupt too (#2267)

* shutdown for all sys signals

* Fix lint
pull/2272/head
Rongjian Lan 5 years ago committed by GitHub
parent 0407e76724
commit f117201ce4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      cmd/harmony/main.go

@ -645,15 +645,10 @@ func main() {
for {
select {
case sig := <-osSignal:
if sig == os.Kill || sig == syscall.SIGTERM {
if sig == os.Kill || sig == syscall.SIGTERM || sig == os.Interrupt {
fmt.Printf("Got %s signal. Gracefully shutting down...\n", sig)
currentNode.ShutDown()
}
if sig == os.Interrupt {
fmt.Printf("Got %s signal. Dumping state to DB...\n", sig)
currentNode.Blockchain().Stop()
currentNode.Beaconchain().Stop()
}
}
}
}()

Loading…
Cancel
Save