Skip to content

Commit 7132ff5

Browse files
committed
add pool customization options
1 parent 92b1e36 commit 7132ff5

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/aleph/http.clj

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,9 @@
136136
| `http-headers` | (HTTP proxy only) an optional map to set additional HTTP headers when establishing connection to the proxy server
137137
| `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
138138
| `connection-timeout` | timeout in milliseconds for the tunnel become established, defaults to 60 seconds, setting is ignored when tunneling is not used."
139-
[{:keys [connections-per-host
139+
[{:keys [pool-builder-fn
140+
pool-controller-builder-fn
141+
connections-per-host
140142
total-connections
141143
target-utilization
142144
connection-options
@@ -170,7 +172,11 @@
170172
(some? log-activity)
171173
(assoc :log-activity (netty/activity-logger "aleph-client" log-activity)))
172174
p (promise)
173-
pool (flow/instrumented-pool
175+
create-pool-fn (or pool-builder-fn
176+
flow/instrumented-pool)
177+
create-pool-ctrl-fn (or pool-controller-builder-fn
178+
#(Pools/utilizationController %1 %2 %3))
179+
pool (create-pool-fn
174180
{:generate (fn [host]
175181
(let [c (promise)
176182
conn (create-connection
@@ -186,7 +192,7 @@
186192
client/close-connection))
187193
:control-period control-period
188194
:max-queue-size max-queue-size
189-
:controller (Pools/utilizationController
195+
:controller (create-pool-ctrl-fn
190196
target-utilization
191197
connections-per-host
192198
total-connections)

0 commit comments

Comments
 (0)