Skip to content

Commit

Permalink
Merge pull request #492 from onflow/gregor/start-wait
Browse files Browse the repository at this point in the history
Wait for sigint signal
  • Loading branch information
sideninja authored Aug 29, 2024
2 parents d2a1b06 + c9546ed commit 2b20aa6
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions cmd/main/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,6 @@ func main() {

ctx, cancel := context.WithCancel(context.Background())

go func() {
osSig := make(chan os.Signal, 1)
signal.Notify(osSig, syscall.SIGINT, syscall.SIGTERM)

<-osSig
fmt.Println("OS Signal to shutdown received, shutting down")
cancel()
}()

ready := make(chan struct{})
go func() {
err = bootstrap.Run(ctx, cfg, ready)
Expand All @@ -43,5 +34,11 @@ func main() {
}()

<-ready
fmt.Println("EVM gateway bootstrap completed, services running")

osSig := make(chan os.Signal, 1)
signal.Notify(osSig, syscall.SIGINT, syscall.SIGTERM)

<-osSig
fmt.Println("OS Signal to shutdown received, shutting down")
cancel()
}

0 comments on commit 2b20aa6

Please sign in to comment.