Skip to content

Commit

Permalink
Don't add the "stale_h" prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
gustawlippa committed Mar 7, 2022
1 parent 7d788c2 commit 9155c8b
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 17 deletions.
4 changes: 2 additions & 2 deletions big_tests/tests/sm_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ common_sm_opts() ->

stale_h(RepeatAfter, Geriatric) ->
#{enabled => true,
stale_h_repeat_after => RepeatAfter,
stale_h_geriatric => Geriatric}.
repeat_after => RepeatAfter,
geriatric => Geriatric}.

make_smid() ->
base64:encode(crypto:strong_rand_bytes(21)).
Expand Down
6 changes: 2 additions & 4 deletions src/stream_management/mod_stream_management.erl
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,9 @@ stale_h_config_spec() ->
#section{
items = #{<<"enabled">> => #option{type = boolean},
<<"repeat_after">> => #option{type = integer,
validate = positive,
wrap = {kv, stale_h_repeat_after}},
validate = positive},
<<"geriatric">> => #option{type = integer,
validate = positive,
wrap = {kv, stale_h_geriatric}}},
validate = positive}},
format_items = map,
include = always,
defaults = #{<<"enabled">> => false,
Expand Down
4 changes: 2 additions & 2 deletions src/stream_management/mod_stream_management_mnesia.erl
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ start_cleaner(Opts) ->
ejabberd_sup:start_child(ChildSpec).

start_link(Opts) ->
gen_server:start_link({local, stream_management_stale_h}, ?MODULE, [Opts], []).
gen_server:start_link({local, stream_management_stale_h}, ?MODULE, Opts, []).

init([#{stale_h_repeat_after := RepeatAfter, stale_h_geriatric := GeriatricAge}]) ->
init(#{repeat_after := RepeatAfter, geriatric := GeriatricAge}) ->
State = #smgc_state{gc_repeat_after = RepeatAfter,
gc_geriatric = GeriatricAge},
schedule_check(State),
Expand Down
12 changes: 5 additions & 7 deletions test/common/config_parser_helper.erl
Original file line number Diff line number Diff line change
Expand Up @@ -658,8 +658,8 @@ all_modules() ->
buffer_max => 30,
resume_timeout => 600,
stale_h => #{enabled => true,
stale_h_geriatric => 3600,
stale_h_repeat_after => 1800}})
geriatric => 3600,
repeat_after => 1800}})
}.

pgsql_modules() ->
Expand Down Expand Up @@ -874,9 +874,7 @@ default_mod_config(mod_stream_management) ->
ack => true,
ack_freq => 1,
resume_timeout => 600,
stale_h => #{enabled => false,
stale_h_repeat_after => 1800,
stale_h_geriatric => 3600}};
stale_h => default_config([modules, mod_stream_management, stale_h])};
default_mod_config(mod_time) ->
#{iqdisc => one_queue};
default_mod_config(mod_vcard) ->
Expand Down Expand Up @@ -921,8 +919,8 @@ default_config([modules, mod_roster, riak]) ->
#{bucket_type => <<"rosters">>, version_bucket_type => <<"roster_versions">>};
default_config([modules, mod_stream_management, stale_h]) ->
#{enabled => false,
stale_h_repeat_after => 1800,
stale_h_geriatric => 3600};
repeat_after => 1800,
geriatric => 3600};
default_config([modules, mod_vcard, ldap]) -> % included when backend => ldap
#{pool_tag => default,
deref => never,
Expand Down
4 changes: 2 additions & 2 deletions test/config_parser_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -2931,8 +2931,8 @@ mod_stream_management_stale_h(_Config) ->
T = fun(Opts) -> #{<<"modules">> =>
#{<<"mod_stream_management">> => #{<<"stale_h">> => Opts}}} end,
?cfgh(P ++ [enabled], true, T(#{<<"enabled">> => true})),
?cfgh(P ++ [stale_h_repeat_after], 999, T(#{<<"repeat_after">> => 999})),
?cfgh(P ++ [stale_h_geriatric], 999, T(#{<<"geriatric">> => 999})),
?cfgh(P ++ [repeat_after], 999, T(#{<<"repeat_after">> => 999})),
?cfgh(P ++ [geriatric], 999, T(#{<<"geriatric">> => 999})),
?cfgh(P, config_parser_helper:default_config(P), T(#{})),

?errh(T(#{<<"enabled">> => <<"true">>})),
Expand Down

0 comments on commit 9155c8b

Please sign in to comment.