Skip to content

Commit

Permalink
Fix see redundant connector caching. (#151)
Browse files Browse the repository at this point in the history
Signed-off-by: minsugn Son <sns2831@gmail.com>
  • Loading branch information
bperhaps committed Oct 14, 2020
1 parent 9c426dc commit 91355b0
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions pkg/fab/comm/connector.go
Expand Up @@ -114,15 +114,13 @@ func (cc *CachingConnector) DialContext(ctx context.Context, target string, opts
logger.Debugf("DialContext: %s", target)

cc.lock.Lock()
c, ok := cc.loadConn(target)
if !ok {
createdConn, err := cc.createConn(ctx, target, opts...)
if err != nil {
cc.lock.Unlock()
return nil, errors.WithMessage(err, "connection creation failed")
}
c = createdConn

createdConn, err := cc.createConn(ctx, target, opts...)
if err != nil {
cc.lock.Unlock()
return nil, errors.WithMessage(err, "connection creation failed")
}
c := createdConn

cc.lock.Unlock()

Expand Down

0 comments on commit 91355b0

Please sign in to comment.