Skip to content

Commit

Permalink
Merge branch 'feature/redesign'
Browse files Browse the repository at this point in the history
  • Loading branch information
Ali Sabil committed Aug 7, 2012
2 parents ef99da8 + d480169 commit 9b4a49c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/mongo_pool.erl
Expand Up @@ -51,15 +51,15 @@ handle_call(get, _From, #state{connections = Connections} = State) ->
Index = random:uniform(array:size(Connections)) - 1,
case array:get(Index, Connections) of
undefined ->
try supervisor:start_child(State#state.supervisor, []) of
case supervisor:start_child(State#state.supervisor, []) of
{ok, Connection} ->
Monitor = erlang:monitor(process, Connection),
{reply, {ok, Connection}, State#state{
connections = array:set(Index, Connection, Connections),
monitors = orddict:store(Monitor, Index, State#state.monitors)
}}
catch
_:Error -> {reply, {error, Error}, State}
}};
{error, Error} ->
{reply, {error, Error}, State}
end;
Connection ->
{reply, {ok, Connection}, State}
Expand Down

0 comments on commit 9b4a49c

Please sign in to comment.