From f4e6a5217c57e84168f963e3a00f21d1a2042eb3 Mon Sep 17 00:00:00 2001 From: Saxon Date: Sat, 2 May 2020 20:37:13 +0930 Subject: [PATCH] revid/senders.go: using len(s.buf) to adjust mtsSender ring buffer instead of len(d) --- revid/senders.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/revid/senders.go b/revid/senders.go index 305426b8..c34ec7f6 100644 --- a/revid/senders.go +++ b/revid/senders.go @@ -273,9 +273,9 @@ func (s *mtsSender) Write(d []byte) (int, error) { s.ring.Flush() } if err != nil { - s.log(logger.Warning, "ringBuffer write error", "error", err.Error(), "n", n, "size", len(s.buf)) + s.log(logger.Warning, "ringBuffer write error", "error", err.Error(), "n", n, "size", len(s.buf), "rb element size", adjustedMTSRBElementSize) if err == ring.ErrTooLong { - adjustedMTSRBElementSize = len(d) * 2 + adjustedMTSRBElementSize = len(s.buf) * 2 numElements := maxBuffLen / adjustedMTSRBElementSize s.ring = ring.NewBuffer(maxBuffLen/adjustedMTSRBElementSize, adjustedMTSRBElementSize, 5*time.Second) s.log(logger.Info, "adjusted MTS ring buffer element size", "new size", adjustedMTSRBElementSize, "num elements", numElements, "size(MB)", numElements*adjustedMTSRBElementSize)