Skip to content

Commit

Permalink
Merge pull request #69 from inaka/jfacorro.68.worker_pool.config.options
Browse files Browse the repository at this point in the history
[Closes #68] Accept `wpool_opts` entry in configuration file.
  • Loading branch information
Brujo Benavides committed Sep 23, 2014
2 parents 9ff1351 + 7e9a139 commit 27f8836
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/sumo_repo.erl
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,14 @@
%% @doc Starts and links a new process for the given repo implementation.
-spec start_link(atom(), module(), [term()]) -> {ok, pid()}.
start_link(Name, Module, Options) ->
Poolsize = proplists:get_value(workers, Options, 100),
WPoolOptions = [ {overrun_warning, infinity}
, {overrun_handler, {error_logger, warning_report}}
, {workers, Poolsize}
, {worker, {?MODULE, [Module, Options]}}
],
wpool:start_pool(Name, WPoolOptions).
Poolsize = proplists:get_value(workers, Options, 100),
WPoolConfigOpts = application:get_env(sumo_db, wpool_opts, []),
WPoolOptions = [ {overrun_warning, infinity}
, {overrun_handler, {error_logger, warning_report}}
, {workers, Poolsize}
, {worker, {?MODULE, [Module, Options]}}
],
wpool:start_pool(Name, WPoolConfigOpts ++ WPoolOptions).

%% @doc Creates the schema of the given docs in the given repository name.
-spec create_schema(atom(), sumo:schema()) -> ok | {error, term()}.
Expand Down

0 comments on commit 27f8836

Please sign in to comment.