moving some logic to tesla adapter

- checking original inside gun adapter
- flushing streams on max_body error
This commit is contained in:
Alexander Strizhakov 2020-03-04 18:13:24 +03:00
commit d6bebd4f9c
No known key found for this signature in database
GPG key ID: 022896A53AEF1381
6 changed files with 6 additions and 34 deletions

View file

@ -28,12 +28,7 @@ defmodule Pleroma.Pool.Request do
end
@impl true
def handle_info({:gun_data, _conn, stream, _, _}, state) do
# in some cases if we reuse conn and got {:error, :body_too_large}
# gun continues to send messages to this process,
# so we flush messages for this request
:ok = :gun.flush(stream)
def handle_info({:gun_data, _conn, _stream, _, _}, state) do
{:noreply, state}
end
@ -49,8 +44,7 @@ defmodule Pleroma.Pool.Request do
end
@impl true
def handle_info({:gun_error, _conn, stream, _error}, state) do
:ok = :gun.flush(stream)
def handle_info({:gun_error, _conn, _stream, _error}, state) do
{:noreply, state}
end