Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# NEWS

4.8.4 - UNRELEASED
4.8.4 - 2026-09-27
------------------

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion src/hackney.app.src
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{application, hackney,
[
{description, "Simple HTTP client with HTTP/1.1, HTTP/2, and HTTP/3 support"},
{vsn, "4.8.3"},
{vsn, "4.8.4"},
{registered, [hackney_pool]},
{applications, [kernel,
stdlib,
Expand Down
16 changes: 15 additions & 1 deletion test/hackney_send_request_tests.erl
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,28 @@ h1_request_releases() ->
try
Url = <<"http://localhost:", (integer_to_binary(?H1_PORT))/binary, "/get">>,
{ok, 200, _, _} = hackney:request(get, Url, [], <<>>, [{pool, Pool}]),
?assertMatch(#{in_use_count := 0, free_count := 1}, stats(Pool))
%% The conn checks itself in with a cast sent after it answers the
%% caller, so the pool can lag request/5 by a moment.
?assertMatch(#{in_use_count := 0, free_count := 1},
wait_stats(Pool, fun(#{free_count := F}) -> F =:= 1 end))
after
hackney_pool:stop_pool(Pool)
end.

stats(Pool) ->
maps:from_list(hackney_pool:get_stats(Pool)).

%% Pool stats once Done holds, or the last stats after 5 s.
wait_stats(Pool, Done) ->
wait_stats(Pool, Done, erlang:monotonic_time(millisecond) + 5000).

wait_stats(Pool, Done, Deadline) ->
Stats = stats(Pool),
case Done(Stats) orelse erlang:monotonic_time(millisecond) > Deadline of
true -> Stats;
false -> receive after 5 -> ok end, wait_stats(Pool, Done, Deadline)
end.

%% Pull a response with stream_body/1 until it ends.
read_chunks(Conn) ->
read_chunks(Conn, <<>>).
Expand Down
Loading