Created
April 24, 2019 17:16
-
-
Save Aceeri/4024ec9717d4555a6fb52039e8834947 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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