Add lock and close check on cassandra as well
This commit is contained in:
parent
3cf61a5d8f
commit
15df4d1f36
|
@ -116,12 +116,15 @@ func (c *cassandraConnectionProducer) Initialize(ctx context.Context, conf map[s
|
|||
}
|
||||
|
||||
func (c *cassandraConnectionProducer) Connection(_ context.Context) (interface{}, error) {
|
||||
c.Lock()
|
||||
defer c.Unlock()
|
||||
|
||||
if !c.Initialized {
|
||||
return nil, connutil.ErrNotInitialized
|
||||
}
|
||||
|
||||
// If we already have a DB, return it
|
||||
if c.session != nil {
|
||||
if c.session != nil && !c.session.Closed() {
|
||||
return c.session, nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue