//from https://talks.golang.org/2012/concurrency.slide#47
c := make(chan Result)
go func() { c <- Web(query) } ()
go func() { c <- Image(query) } ()
go func() { c <- Video(query) } ()
timeout := time.After(80 * time.Millisecond)
for i := 0; i < 3; i++ {
select {
case result := <-c:
results = append(results, result)
case <-timeout:
fmt.Println("timed out")
return
}
}
return
func monitorInstallProgress(s *InstalledSkill, c mindsocket.RemoteConn, body io.ReadCloser) {
for {
select {
case <-s.passThru.ticker.C:
if err := sendInstallProcess(s, c); err != nil {
return
}
case <-s.passThru.quit:
body.Close()
loggers.Debug.Println("quit succeed")
return
}
}
}