Skip to content

Instantly share code, notes, and snippets.

@Aceeri
Created April 24, 2019 17:16
Show Gist options
  • Select an option

  • Save Aceeri/4024ec9717d4555a6fb52039e8834947 to your computer and use it in GitHub Desktop.

Select an option

Save Aceeri/4024ec9717d4555a6fb52039e8834947 to your computer and use it in GitHub Desktop.
for {
select {
case msg, ok := <-responseChan:
if !ok {
break
}
if msg == nil {
break
}
message = msg
return
case <-time.After(300 * time.Second):
//close(responseChan)
err = fmt.Errorf("request timed out")
return
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment