From 7ef59df0b284de3e0a7ead8a653292d4854bd27d Mon Sep 17 00:00:00 2001 From: Jeff Mitchell Date: Tue, 19 Dec 2017 10:38:26 -0500 Subject: [PATCH] Add lock to sql connection as well --- plugins/helper/database/connutil/sql.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/helper/database/connutil/sql.go b/plugins/helper/database/connutil/sql.go index 2e34065d03..8a7f57e077 100644 --- a/plugins/helper/database/connutil/sql.go +++ b/plugins/helper/database/connutil/sql.go @@ -76,6 +76,9 @@ func (c *SQLConnectionProducer) Initialize(ctx context.Context, conf map[string] } func (c *SQLConnectionProducer) Connection(ctx context.Context) (interface{}, error) { + c.Lock() + defer c.Unlock() + if !c.Initialized { return nil, ErrNotInitialized }