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) ->
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) ->
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}).
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) ->