Skip to content

Commit 4d22181

Browse files
authored
Merge pull request #24 from spiral/feature/better-server-stop
Improved container Stop sequence
2 parents 9e39b07 + 248011f commit 4d22181

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

cmd/rr/cmd/serve.go

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,17 @@ func init() {
3333
CLI.AddCommand(&cobra.Command{
3434
Use: "serve",
3535
Short: "Serve RoadRunner service(s)",
36-
RunE: serveHandler,
36+
Run: serveHandler,
3737
})
3838

3939
signal.Notify(stopSignal, os.Interrupt, os.Kill, syscall.SIGTERM)
4040
}
4141

42-
func serveHandler(cmd *cobra.Command, args []string) error {
42+
func serveHandler(cmd *cobra.Command, args []string) {
4343
go func() {
44-
Container.Serve()
45-
stopSignal <- nil
44+
<-stopSignal
45+
Container.Stop()
4646
}()
4747

48-
<-stopSignal
49-
Container.Stop()
50-
51-
return nil
48+
Container.Serve()
5249
}

0 commit comments

Comments
 (0)