mirror of
https://github.com/prometheus/statsd_exporter.git
synced 2024-11-22 15:30:59 +00:00
Merge pull request #253 from tcolgate/eventrace
Event queue processes and filling race.
This commit is contained in:
commit
353b38c80b
1 changed files with 2 additions and 1 deletions
3
event.go
3
event.go
|
@ -82,6 +82,7 @@ func newEventQueue(c chan Events, flushThreshold int, flushInterval time.Duratio
|
|||
c: c,
|
||||
flushThreshold: flushThreshold,
|
||||
flushTicker: ticker,
|
||||
q: make([]Event, 0, flushThreshold),
|
||||
}
|
||||
go func() {
|
||||
for {
|
||||
|
@ -112,7 +113,7 @@ func (eq *eventQueue) flush() {
|
|||
|
||||
func (eq *eventQueue) flushUnlocked() {
|
||||
eq.c <- eq.q
|
||||
eq.q = eq.q[:0]
|
||||
eq.q = make([]Event, 0, cap(eq.q))
|
||||
eventsFlushed.Inc()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue