Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix set_default_connection_limit not being respected #1053

Merged
merged 2 commits into from
May 19, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/Connections.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,14 @@ function __init__()
return
end

set_default_connection_limit!(n) = default_connection_limit[] = n
function set_default_connection_limit!(n)
default_connection_limit[] = n
# reinitialize the global connection pools
TCP_POOL[] = CPool{Sockets.TCPSocket}(n)
MBEDTLS_POOL[] = CPool{MbedTLS.SSLContext}(n)
OPENSSL_POOL[] = CPool{OpenSSL.SSLStream}(n)
return
end

"""
Connection
Expand Down
1 change: 1 addition & 0 deletions test/client.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ using InteractiveUtils: @which

# test we can adjust default_connection_limit
HTTP.set_default_connection_limit!(12)
@test HTTP.Connections.TCP_POOL[].max == 12
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly paranoid, but might save us at some point: Perhaps test the same expectation of the other pools?

quinnj marked this conversation as resolved.
Show resolved Hide resolved

@testset "@client macro" begin
@eval module MyClient
Expand Down