mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
Convert oauth_expire option to accept timeout values
This commit is contained in:
parent
3821208bb1
commit
9822535e70
@ -202,11 +202,11 @@ init([]) ->
|
||||
init_cache(DBMod),
|
||||
Expire = expire(),
|
||||
application:set_env(oauth2, backend, ejabberd_oauth),
|
||||
application:set_env(oauth2, expiry_time, Expire),
|
||||
application:set_env(oauth2, expiry_time, Expire div 1000),
|
||||
application:start(oauth2),
|
||||
ejabberd_commands:register_commands(get_commands_spec()),
|
||||
ejabberd_hooks:add(config_reloaded, ?MODULE, config_reloaded, 50),
|
||||
erlang:send_after(expire() * 1000, self(), clean),
|
||||
erlang:send_after(expire(), self(), clean),
|
||||
{ok, ok}.
|
||||
|
||||
handle_call(Request, From, State) ->
|
||||
@ -222,7 +222,7 @@ handle_info(clean, State) ->
|
||||
TS = 1000000 * MegaSecs + Secs,
|
||||
DBMod = get_db_backend(),
|
||||
DBMod:clean(TS),
|
||||
erlang:send_after(trunc(expire() * 1000 * (1 + MiniSecs / 1000000)),
|
||||
erlang:send_after(trunc(expire() * (1 + MiniSecs / 1000000)),
|
||||
self(), clean),
|
||||
{noreply, State};
|
||||
handle_info(Info, State) ->
|
||||
|
@ -632,7 +632,7 @@ oauth_client_id_check(Host) ->
|
||||
oauth_db_type() ->
|
||||
ejabberd_config:get_option({oauth_db_type, global}).
|
||||
|
||||
-spec oauth_expire() -> non_neg_integer().
|
||||
-spec oauth_expire() -> pos_integer().
|
||||
oauth_expire() ->
|
||||
ejabberd_config:get_option({oauth_expire, global}).
|
||||
|
||||
|
@ -231,7 +231,7 @@ opt_type(oauth_cache_size) ->
|
||||
opt_type(oauth_db_type) ->
|
||||
econf:db_type(ejabberd_oauth);
|
||||
opt_type(oauth_expire) ->
|
||||
econf:non_neg_int();
|
||||
econf:timeout(second);
|
||||
opt_type(oauth_use_cache) ->
|
||||
econf:bool();
|
||||
opt_type(oauth_client_id_check) ->
|
||||
|
Loading…
Reference in New Issue
Block a user