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 e1b1235 commit b1bddc0Copy full SHA for b1bddc0
queue.go
@@ -154,7 +154,10 @@ func (q ChannelQueue[T]) Take() (T, error) {
154
// TakeWithTimeout Take the T val(blocking), with timeout
155
func (q ChannelQueue[T]) TakeWithTimeout(timeout time.Duration) (T, error) {
156
select {
157
- case val := <-q:
+ case val, ok := <-q:
158
+ if !ok {
159
+ return *new(T), ErrQueueIsClosed
160
+ }
161
return val, nil
162
case <-time.After(timeout):
163
return *new(T), ErrQueueTakeTimeout
0 commit comments