summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaweł Chmielowski <pchmielowski@process-one.net>2019-10-15 11:18:29 +0200
committerPaweł Chmielowski <pchmielowski@process-one.net>2019-10-15 11:28:47 +0200
commit9822535e70f15651f19c20e7183dfec7de2870e3 (patch)
tree49e826809f3210401730070e740da90797168abd
parentImprove type spec of properties() (diff)
Convert oauth_expire option to accept timeout values
-rw-r--r--src/ejabberd_oauth.erl6
-rw-r--r--src/ejabberd_option.erl2
-rw-r--r--src/ejabberd_options.erl2
3 files changed, 5 insertions, 5 deletions
diff --git a/src/ejabberd_oauth.erl b/src/ejabberd_oauth.erl
index 3c95dbb3..1ba1505b 100644
--- a/src/ejabberd_oauth.erl
+++ b/src/ejabberd_oauth.erl
@@ -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) ->
diff --git a/src/ejabberd_option.erl b/src/ejabberd_option.erl
index 94e79d80..81b0f0c1 100644
--- a/src/ejabberd_option.erl
+++ b/src/ejabberd_option.erl
@@ -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}).
diff --git a/src/ejabberd_options.erl b/src/ejabberd_options.erl
index 7bfa06ee..126891bc 100644
--- a/src/ejabberd_options.erl
+++ b/src/ejabberd_options.erl
@@ -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) ->