diff --git a/ees/elastic.go b/ees/elastic.go index bcdb3aff1..e71cc977a 100644 --- a/ees/elastic.go +++ b/ees/elastic.go @@ -160,12 +160,12 @@ func (eEe *ElasticEE) Cfg() *config.EventExporterCfg { return eEe.cfg } func (eEe *ElasticEE) Connect() (err error) { eEe.Lock() + defer eEe.Unlock() // create the client if eEe.eClnt != nil { return } eEe.eClnt, err = elasticsearch.NewClient(eEe.clnOpts) - eEe.Unlock() return }