State;
maybe_adjust_resume_timeout(#{push_resume_timeout := Timeout} = State) ->
OrigTimeout = mod_stream_mgmt:get_resume_timeout(State),
- ?DEBUG("Adjusting resume timeout to ~B seconds", [Timeout]),
+ ?DEBUG("Adjusting resume timeout to ~B seconds", [Timeout div 1000]),
State1 = mod_stream_mgmt:set_resume_timeout(State, Timeout),
State1#{push_resume_timeout_orig => OrigTimeout}.
-spec maybe_restore_resume_timeout(c2s_state()) -> c2s_state().
maybe_restore_resume_timeout(#{push_resume_timeout_orig := Timeout} = State) ->
- ?DEBUG("Restoring resume timeout to ~B seconds", [Timeout]),
+ ?DEBUG("Restoring resume timeout to ~B seconds", [Timeout div 1000]),
State1 = mod_stream_mgmt:set_resume_timeout(State, Timeout),
maps:remove(push_resume_timeout_orig, State1);
maybe_restore_resume_timeout(State) ->
push_resume_timeout := ResumeTimeout} = State)
when is_integer(ResumeTimeout), ResumeTimeout > ?PUSH_BEFORE_TIMEOUT_PERIOD ->
WakeTimeout = ResumeTimeout - ?PUSH_BEFORE_TIMEOUT_PERIOD,
- ?DEBUG("Scheduling wake-up timer to fire in ~B seconds", [WakeTimeout]),
+ ?DEBUG("Scheduling wake-up timer to fire in ~B seconds", [WakeTimeout div 1000]),
erlang:start_timer(WakeTimeout, self(), push_keepalive),
State;
maybe_start_wakeup_timer(State) ->
#sm_enabled{xmlns = Xmlns,
id = make_resume_id(State),
resume = true,
- max = Timeout};
+ max = Timeout div 1000};
true ->
?DEBUG("Stream management without resumption enabled for ~s",
[jid:encode(JID)]),
transition_to_pending(#{mgmt_state := active, jid := JID,
lserver := LServer, mgmt_timeout := Timeout} = State) ->
State1 = cancel_ack_timer(State),
- ?INFO_MSG("Waiting for resumption of stream for ~s", [jid:encode(JID)]),
+ ?INFO_MSG("Waiting ~B seconds for resumption of stream for ~s",
+ [Timeout div 1000, jid:encode(JID)]),
TRef = erlang:start_timer(Timeout, self(), pending_timeout),
State2 = State1#{mgmt_state => pending, mgmt_pending_timer => TRef},
ejabberd_hooks:run_fold(c2s_session_pending, LServer, State2, []);