浏览代码

Merge pull request #377 from Zariel/policy-pool-sync-fill

When initially filling the host pool do it sync.
Ben Hood 10 年之前
父节点
当前提交
08128431dc
共有 1 个文件被更改,包括 12 次插入0 次删除
  1. 12 0
      connectionpool.go

+ 12 - 0
connectionpool.go

@@ -762,6 +762,18 @@ func (pool *hostConnPool) fill() {
 
 		// filled one
 		fillCount--
+
+		// connect all connections to this host in sync
+		for fillCount > 0 {
+			err := pool.connect()
+			pool.logConnectErr(err)
+
+			// decrement, even on error
+			fillCount--
+		}
+
+		go pool.fillingStopped()
+		return
 	}
 
 	// fill the rest of the pool asynchronously