mirror of
https://github.com/valitydev/wapi-lib.git
synced 2024-11-07 02:35:18 +00:00
Bound session poll timeouts during withdrawal processing (#50)
This commit is contained in:
parent
93a439ddaa
commit
6001bfd993
@ -128,6 +128,8 @@ transfer(St) ->
|
||||
|
||||
%% Machinery
|
||||
|
||||
-define(MAX_SESSION_POLL_TIMEOUT, 4 * 60 * 60).
|
||||
|
||||
-type machine() :: ff_machine:machine(event(_)).
|
||||
-type result() :: ff_machine:result(event(_)).
|
||||
-type handler_opts() :: machinery:handler_opts(_).
|
||||
@ -181,9 +183,12 @@ set_action(undefined, _St) ->
|
||||
undefined;
|
||||
set_action(poll, St) ->
|
||||
Now = machinery_time:now(),
|
||||
Timeout = erlang:max(1, machinery_time:interval(Now, ff_machine:updated(St)) div 1000),
|
||||
{set_timer, {timeout, Timeout}}.
|
||||
{set_timer, {timeout, compute_poll_timeout(Now, St)}}.
|
||||
|
||||
compute_poll_timeout(Now, St) ->
|
||||
MaxTimeout = genlib_app:env(ff_transfer, max_session_poll_timeout, ?MAX_SESSION_POLL_TIMEOUT),
|
||||
Timeout0 = machinery_time:interval(Now, ff_machine:updated(St)) div 1000,
|
||||
erlang:min(MaxTimeout, erlang:max(1, Timeout0)).
|
||||
|
||||
%% Handler convertors
|
||||
|
||||
|
@ -99,7 +99,8 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}}
|
||||
}},
|
||||
{max_session_poll_timeout, 14400} %% 4h
|
||||
]},
|
||||
|
||||
%% wapi
|
||||
|
Loading…
Reference in New Issue
Block a user