move sleep into the select
as it is it simply slows down the writer if there are many messages
This commit is contained in:
parent
9a23ede4fd
commit
7f27c80a6a
@ -30,11 +30,10 @@ func (p *Processor) subMpool(ctx context.Context) {
|
|||||||
|
|
||||||
loop:
|
loop:
|
||||||
for {
|
for {
|
||||||
time.Sleep(10 * time.Millisecond)
|
|
||||||
select {
|
select {
|
||||||
case update := <-sub:
|
case update := <-sub:
|
||||||
updates = append(updates, update)
|
updates = append(updates, update)
|
||||||
default:
|
case <-time.After(10 * time.Millisecond):
|
||||||
break loop
|
break loop
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user