Slide 23
Slide 23 text
// Setup
ctx, cancel := context.WithCancel(context.Background())
ln, _ := net.Listen("tcp", ":8080")
cancelCron := make(chan struct{})
go sm.Run(ctx) // cancel()
go http.Serve(ln, api) // ln.Close()
go cronJobs(cancelCron, sm) // close(cancelCron)
go signalCatcher(???) // ?
// wait for shutdown somehow