Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

Commit

Permalink
Catch http drain errors in wait_response.
Browse files Browse the repository at this point in the history
  • Loading branch information
archaelus committed Jul 4, 2012
1 parent 1ec78aa commit a92b088
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/logplex_http_drain.erl
Expand Up @@ -221,7 +221,7 @@ status_action(_) -> temp_fail.

wait_response(Frame = #frame{},
State = #state{client = Client}) ->
case cowboy_client:response(Client) of
try cowboy_client:response(Client) of
{ok, Status, _Headers, Client2} ->
Result = status_action(Status),
?INFO("drain_id=~p channel_id=~p dest=~s at=response "
Expand All @@ -244,6 +244,13 @@ wait_response(Frame = #frame{},
" result=error tcp_err=~10000p",
log_info(State, [Why])),
http_fail(retry_frame(Frame, State))
catch
Class:Err ->
Report = {Class, Err, erlang:get_stacktrace()},
?WARN("drain_id=~p channel_id=~p dest=~s at=wait_response "
"attempt=fail err=exception data=~p next_state=disconnected",
log_info(State, [Report])),
http_fail(retry_frame(Frame,State))
end.

%% @private
Expand Down

0 comments on commit a92b088

Please sign in to comment.