mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-29 01:33:10 -06:00
Tweaks
This commit is contained in:
parent
9fe6b01f94
commit
eb42429b72
|
|
@ -311,7 +311,6 @@ func (t *inputWorker) run() {
|
||||||
}
|
}
|
||||||
defer t.running.Store(false)
|
defer t.running.Store(false)
|
||||||
for {
|
for {
|
||||||
<-t.input.wait()
|
|
||||||
task, ok := t.input.pop()
|
task, ok := t.input.pop()
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -49,16 +49,3 @@ func (q *fifoQueue) pop() (*inputTask, bool) {
|
||||||
}
|
}
|
||||||
return frame, true
|
return frame, true
|
||||||
}
|
}
|
||||||
|
|
||||||
// wait returns a channel which can be used to detect when an
|
|
||||||
// item is waiting in the queue.
|
|
||||||
func (q *fifoQueue) wait() <-chan struct{} {
|
|
||||||
q.mutex.Lock()
|
|
||||||
defer q.mutex.Unlock()
|
|
||||||
if q.count > 0 && len(q.notifs) == 0 {
|
|
||||||
ch := make(chan struct{})
|
|
||||||
close(ch)
|
|
||||||
return ch
|
|
||||||
}
|
|
||||||
return q.notifs
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue