Преглед изворни кода

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
 		// filled one
 		fillCount--
 		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
 	// fill the rest of the pool asynchronously