Small refactoring
This commit is contained in:
parent
baf73f33e7
commit
883d25898e
3 changed files with 8 additions and 8 deletions
6
main.go
6
main.go
|
@ -25,12 +25,12 @@ func main() {
|
|||
// Register signal handler
|
||||
sc := make(chan os.Signal, 1)
|
||||
signal.Notify(sc, syscall.SIGINT, syscall.SIGTERM)
|
||||
go func(ch chan os.Signal, resp *types.SpaceAPIResponseV14) {
|
||||
<-ch
|
||||
go func(resp *types.SpaceAPIResponseV14) {
|
||||
<-sc
|
||||
log.Println("Saving state and shutting down...")
|
||||
util.SaveCurrentState(*resp)
|
||||
os.Exit(0)
|
||||
}(sc, &spaceApiResponse)
|
||||
}(&spaceApiResponse)
|
||||
|
||||
// Register HTTP handlers
|
||||
http.HandleFunc("/", handlers.Root(&spaceApiResponse))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue