diff --git a/tracer.go b/tracer.go index 6e52c28c..dbef80a8 100644 --- a/tracer.go +++ b/tracer.go @@ -178,11 +178,14 @@ func (t *RemoteTracer) doWrite() { for { _, ok := <-t.ch - // nil out the buffer to gc events + // nil out the buffer to gc events when swapping buffers for i := range buf { buf[i] = nil } + // wait a bit to accumulate a batch + time.Sleep(time.Second) + t.mx.Lock() tmp := t.buf t.buf = buf[:0]