mirror of
https://github.com/mum4k/termdash.git
synced 2025-04-27 13:48:49 +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()
|
u.cond.L.Lock()
|
||||||
defer u.cond.L.Unlock()
|
defer u.cond.L.Unlock()
|
||||||
for {
|
for {
|
||||||
if e := u.Pop(); e != nil {
|
|
||||||
return e, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
return nil, ctx.Err()
|
return nil, ctx.Err()
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if e := u.Pop(); e != nil {
|
||||||
|
return e, nil
|
||||||
|
}
|
||||||
u.cond.Wait()
|
u.cond.Wait()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user