mirror of
https://github.com/mum4k/termdash.git
synced 2025-04-25 13:48:50 +08:00
Don't pop from the queue after context expiry.
This commit is contained in:
parent
2d4d903f87
commit
9b5caa35f5
@ -126,16 +126,15 @@ func (u *Unbound) Pull(ctx context.Context) (terminalapi.Event, error) {
|
||||
u.cond.L.Lock()
|
||||
defer u.cond.L.Unlock()
|
||||
for {
|
||||
if e := u.Pop(); e != nil {
|
||||
return e, nil
|
||||
}
|
||||
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return nil, ctx.Err()
|
||||
default:
|
||||
}
|
||||
|
||||
if e := u.Pop(); e != nil {
|
||||
return e, nil
|
||||
}
|
||||
u.cond.Wait()
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user