From 2fc5518a003530845dc46584651569866a6165ef Mon Sep 17 00:00:00 2001 From: vyzo Date: Thu, 14 Nov 2019 13:05:18 +0200 Subject: [PATCH] remote tracer: wait a second to accumulate batches --- tracer.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tracer.go b/tracer.go index 6e52c28..dbef80a 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]