From 0ef12f87af5263c83e4775ff320679965ae9385b Mon Sep 17 00:00:00 2001 From: Daniel Nelson Date: Tue, 3 Jul 2018 11:35:39 -0700 Subject: [PATCH] Add mutex to prevent handler precision from changing during parse (#4373) --- plugins/inputs/http_listener/http_listener.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/inputs/http_listener/http_listener.go b/plugins/inputs/http_listener/http_listener.go index 595c74ed2..6415ebc9f 100644 --- a/plugins/inputs/http_listener/http_listener.go +++ b/plugins/inputs/http_listener/http_listener.go @@ -343,6 +343,9 @@ func (h *HTTPListener) serveWrite(res http.ResponseWriter, req *http.Request) { } func (h *HTTPListener) parse(b []byte, t time.Time, precision string) error { + h.mu.Lock() + defer h.mu.Unlock() + h.handler.SetTimePrecision(getPrecisionMultiplier(precision)) h.handler.SetTimeFunc(func() time.Time { return t }) metrics, err := h.parser.Parse(b)