From 0d5f95bbefc7ef7e3b547f4eaeb063f56637aa12 Mon Sep 17 00:00:00 2001 From: Kane Dou Date: Tue, 17 May 2016 18:02:51 +0800 Subject: [PATCH] fix mongodb input concurrent map read/write --- plugins/inputs/mongodb/mongodb.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/inputs/mongodb/mongodb.go b/plugins/inputs/mongodb/mongodb.go index 381814531..f38fa31ef 100644 --- a/plugins/inputs/mongodb/mongodb.go +++ b/plugins/inputs/mongodb/mongodb.go @@ -69,10 +69,10 @@ func (m *MongoDB) Gather(acc telegraf.Accumulator) error { } } wg.Add(1) - go func() { + go func(srv *Server) { defer wg.Done() - outerr = m.gatherServer(m.getMongoServer(u), acc) - }() + outerr = m.gatherServer(srv, acc) + }(m.getMongoServer(u)) } wg.Wait()