Skip to content
Open
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
11 changes: 7 additions & 4 deletions src/pgapp_worker.erl
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ handle_call({transaction, Fun}, _From,
handle_cast(reconnect, State) ->
{noreply, connect(State)}.

handle_info({'EXIT', From, Reason}, State) ->
handle_info({'EXIT', Conn, Reason}, #state{conn=Conn} = State) ->
{NewDelay, Tref} =
case State#state.timer of
undefined ->
Expand All @@ -137,9 +137,12 @@ handle_info({'EXIT', From, Reason}, State) ->
end,

error_logger:warning_msg(
"~p EXIT from ~p: ~p - attempting to reconnect in ~p ms~n",
[self(), From, Reason, NewDelay]),
{noreply, State#state{conn = undefined, delay = NewDelay, timer = Tref}}.
"~p EXIT from epgsql_sock ~p: ~p - attempting to reconnect in ~p ms~n",
[self(), Conn, Reason, NewDelay]),
{noreply, State#state{conn = undefined, delay = NewDelay, timer = Tref}};

handle_info(_Other, State) ->
Copy link
Member

Choose a reason for hiding this comment

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

Do we really want that extra clause?

{noreply, State}.

terminate(_Reason, #state{conn = undefined}) ->
ok;
Expand Down