Skip to content

Commit

Permalink
invert pool exists check to always fill on the same path
Browse files Browse the repository at this point in the history
  • Loading branch information
Zariel committed Feb 2, 2016
1 parent 05a3cd6 commit c771797
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions connectionpool.go
Expand Up @@ -241,24 +241,19 @@ func (p *policyConnPool) Close() {

func (p *policyConnPool) addHost(host *HostInfo) {
p.mu.Lock()

pool, ok := p.hostConnPools[host.Peer()]
if ok {
p.mu.Unlock()
pool.fill()
return
if !ok {
pool = newHostConnPool(
p.session,
host,
host.Port(),
p.numConns,
p.keyspace,
p.connPolicy(),
)

p.hostConnPools[host.Peer()] = pool
}

pool = newHostConnPool(
p.session,
host,
host.Port(),
p.numConns,
p.keyspace,
p.connPolicy(),
)

p.hostConnPools[host.Peer()] = pool
p.mu.Unlock()

pool.fill()
Expand Down

0 comments on commit c771797

Please sign in to comment.