mirror of
https://github.com/valitydev/epg_connector.git
synced 2024-11-06 00:05:21 +00:00
TD-927: small fix
This commit is contained in:
parent
16d9505aad
commit
bf3397eca2
@ -24,7 +24,7 @@ query({error, _} = Err, _Pool, _Stmt, _Params) ->
|
||||
Err;
|
||||
query(Conn, Pool, Stmt, Params) when is_pid(Conn) ->
|
||||
Result = epgsql:equery(Conn, Stmt, Params),
|
||||
_ = epg_pool_mgr:checkin(Pool, self(), Conn),
|
||||
ok = epg_pool_mgr:checkin(Pool, self(), Conn),
|
||||
Result.
|
||||
|
||||
transaction(Pool, Fun) when is_atom(Pool) ->
|
||||
@ -38,7 +38,7 @@ transaction({error, _} = Err, _Pool, _Fun) ->
|
||||
Err;
|
||||
transaction(Conn, Pool, Fun) when is_pid(Conn) ->
|
||||
Result = epgsql:with_transaction(Conn, Fun),
|
||||
_ = epg_pool_mgr:checkin(Pool, self(), Conn),
|
||||
ok = epg_pool_mgr:checkin(Pool, self(), Conn),
|
||||
Result.
|
||||
|
||||
with(Pool, Fun) when is_atom(Pool) ->
|
||||
@ -50,5 +50,5 @@ with(empty, _Pool, _F) ->
|
||||
{error, overload};
|
||||
with(Conn, Pool, Fun) when is_pid(Conn) ->
|
||||
Result = Fun(Conn),
|
||||
_ = epg_pool_mgr:checkin(Pool, self(), Conn),
|
||||
ok = epg_pool_mgr:checkin(Pool, self(), Conn),
|
||||
Result.
|
||||
|
@ -15,7 +15,8 @@ start_link(PoolName, DbParams, Size, _N) ->
|
||||
|
||||
init([PoolName, DbParams, Size]) ->
|
||||
erlang:process_flag(trap_exit, true),
|
||||
{ok, #epg_pool_wrk_state{pool = PoolName, params = DbParams, size = Size}, {continue, init}}.
|
||||
State0 = #epg_pool_wrk_state{pool = PoolName, params = DbParams, size = Size},
|
||||
{ok, connect(State0)}.
|
||||
|
||||
handle_continue(init, State) ->
|
||||
{noreply, connect(State)}.
|
||||
|
Loading…
Reference in New Issue
Block a user