|
103 | 103 | | `control-period` | the interval, in milliseconds, between use of the controller to adjust the size of the pool, defaults to `60000`
|
104 | 104 | | `dns-options` | an optional map with async DNS resolver settings, for more information check `aleph.netty/dns-resolver-group`. When set, ignores `name-resolver` setting from `connection-options` in favor of shared DNS resolver instance
|
105 | 105 | | `middleware` | a function to modify request before sending, defaults to `aleph.http.client-middleware/wrap-request`
|
| 106 | + | `pool-builder-fn` | a one arity function which returns a `io.aleph.dirigiste.IPool` from a map containing the following keys: `generate`, `destroy`, `control-period`, `max-queue-length` and `stats-callback`. |
| 107 | + | `pool-controller-builder-fn` | a zero arity function which returns a `io.aleph.dirigiste.IPool$Controller`. |
106 | 108 |
|
107 | 109 | the `connection-options` are a map describing behavior across all connections:
|
108 | 110 |
|
|
136 | 138 | | `http-headers` | (HTTP proxy only) an optional map to set additional HTTP headers when establishing connection to the proxy server
|
137 | 139 | | `tunnel?` | (HTTP proxy only) if `true`, sends HTTP CONNECT to the proxy and waits for the 'HTTP/1.1 200 OK' response before sending any subsequent requests. Defaults to `false`. When using authorization or specifying additional headers uses tunneling disregarding this setting
|
138 | 140 | | `connection-timeout` | timeout in milliseconds for the tunnel become established, defaults to 60 seconds, setting is ignored when tunneling is not used."
|
139 |
| - [{:keys [pool-builder-fn |
140 |
| - pool-controller-builder-fn |
141 |
| - connections-per-host |
| 141 | + [{:keys [connections-per-host |
142 | 142 | total-connections
|
143 | 143 | target-utilization
|
144 | 144 | connection-options
|
145 | 145 | dns-options
|
146 | 146 | stats-callback
|
147 | 147 | control-period
|
148 | 148 | middleware
|
149 |
| - max-queue-size] |
| 149 | + max-queue-size |
| 150 | + pool-builder-fn |
| 151 | + pool-controller-builder-fn] |
150 | 152 | :or {connections-per-host 8
|
151 | 153 | total-connections 1024
|
152 | 154 | target-utilization 0.9
|
|
175 | 177 | create-pool-fn (or pool-builder-fn
|
176 | 178 | flow/instrumented-pool)
|
177 | 179 | create-pool-ctrl-fn (or pool-controller-builder-fn
|
178 |
| - #(Pools/utilizationController %1 %2 %3)) |
| 180 | + #(Pools/utilizationController target-utilization connections-per-host total-connections)) |
179 | 181 | pool (create-pool-fn
|
180 | 182 | {:generate (fn [host]
|
181 | 183 | (let [c (promise)
|
|
192 | 194 | client/close-connection))
|
193 | 195 | :control-period control-period
|
194 | 196 | :max-queue-size max-queue-size
|
195 |
| - :controller (create-pool-ctrl-fn |
196 |
| - target-utilization |
197 |
| - connections-per-host |
198 |
| - total-connections) |
| 197 | + :controller (create-pool-ctrl-fn) |
199 | 198 | :stats-callback stats-callback})]
|
200 | 199 | @(deliver p pool)))
|
201 | 200 |
|
|
0 commit comments