Skip to content

Instantly share code, notes, and snippets.

@jamescarr
Created August 30, 2017 04:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamescarr/095e27dffa211b08fb18773aea6c05f8 to your computer and use it in GitHub Desktop.
Save jamescarr/095e27dffa211b08fb18773aea6c05f8 to your computer and use it in GitHub Desktop.
for {
select {
case m, ok := <-c:
if !ok {
breakl
}
handle(m)
case <-time.After(1 * time.Minute):
fmt.Println("timed out")
break
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment