We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ad3e1be commit 01f5707Copy full SHA for 01f5707
queue.go
@@ -154,7 +154,10 @@ func (q ChannelQueue) Take() (interface{}, error) {
154
// TakeWithTimeout Take the val(blocking), with timeout
155
func (q ChannelQueue) TakeWithTimeout(timeout time.Duration) (interface{}, error) {
156
select {
157
- case val := <-q:
+ case val, ok := <-q:
158
+ if !ok {
159
+ return *new(interface{}), ErrQueueIsClosed
160
+ }
161
return val, nil
162
case <-time.After(timeout):
163
return *new(interface{}), ErrQueueTakeTimeout
0 commit comments