Small refactoring

This commit is contained in:
Bendodroid 2024-01-06 19:43:51 +01:00
commit 883d25898e
Signed by: bendodroid
GPG key ID: 3EEE19A0F73D5FFC
3 changed files with 8 additions and 8 deletions

View file

@ -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))