Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Service and module options only in maps #3625

Merged
merged 19 commits into from
Apr 8, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
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
4 changes: 2 additions & 2 deletions src/mongoose_backend.erl
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
-spec init(HostType :: host_type_or_global(),
MainModule :: main_module(),
TrackedFuns :: [function_name()],
Opts :: gen_mod:module_opts()) -> ok.
Opts :: map()) -> ok.
init(HostType, MainModule, TrackedFuns, Opts) ->
ensure_backend_metrics(MainModule, TrackedFuns),
Backend = gen_mod:get_opt(backend, Opts, mnesia),
Backend = maps:get(backend, Opts, mnesia),
BackendModule = backend_module(MainModule, Backend),
persist_backend_name(HostType, MainModule, Backend, BackendModule),
ok.
Expand Down
3 changes: 1 addition & 2 deletions src/wpool/mongoose_wpool_rdbms.erl
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ stop(_, _) ->
do_start(HostType, Tag, WpoolOpts0, RdbmsOpts) when is_list(WpoolOpts0) and is_map(RdbmsOpts) ->
BackendName = backend_name(RdbmsOpts),
KVRdbmsOpts = maps:to_list(RdbmsOpts),
BackendOpts = KVRdbmsOpts ++ [{backend, BackendName}],
mongoose_backend:init(global, mongoose_rdbms, [query, execute], BackendOpts),
mongoose_backend:init(global, mongoose_rdbms, [query, execute], #{backend => BackendName}),
Premwoik marked this conversation as resolved.
Show resolved Hide resolved

mongoose_metrics:ensure_db_pool_metric({rdbms, HostType, Tag}),
WpoolOpts = make_wpool_opts(WpoolOpts0, KVRdbmsOpts),
Expand Down
4 changes: 2 additions & 2 deletions test/mongoose_rdbms_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ tests() ->
init_per_group(odbc, Config) ->
case code:ensure_loaded(eodbc) of
{module, eodbc} ->
mongoose_backend:init(global, mongoose_rdbms, [], [{backend, odbc}]),
mongoose_backend:init(global, mongoose_rdbms, [], #{backend => odbc}),
[{db_type, odbc} | Config];
_ ->
{skip, no_odbc_application}
end;
init_per_group(Group, Config) ->
mongoose_backend:init(global, mongoose_rdbms, [], [{backend, Group}]),
mongoose_backend:init(global, mongoose_rdbms, [], #{backend => Group}),
[{db_type, Group} | Config].

end_per_group(_, Config) ->
Expand Down