Skip to content

Commit

Permalink
Skip a response body to avoid potential connection leak
Browse files Browse the repository at this point in the history
In hackney_pool, connections won't be checked in until the response body
was read or skipped by calling functions like `:hackney.body/1` or
`:hackney.skip_body/1` (this is expected behavior as of
benoitc/hackney#160).
  • Loading branch information
enerick committed Mar 16, 2018
1 parent 8d5b195 commit e3fc97f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/tzdata/data_loader.ex
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ defmodule Tzdata.DataLoader do
{:ok, 200, _headers, client_ref} ->
{:ok, body} = :hackney.body(client_ref)
{:ok, byte_size(body)}
{:ok, _status, _headers, client_ref} ->
:hackney.skip_body(client_ref)
{:error, :did_not_get_ok_response}

_ ->
{:error, :did_not_get_ok_response}
Expand Down

0 comments on commit e3fc97f

Please sign in to comment.