Переглянути джерело

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