iface #31

Merged
zxq9 merged 27 commits from iface into master 2025-12-30 22:32:33 +09:00
Showing only changes of commit 03b1f31935 - Show all commits

View File

@ -641,7 +641,7 @@ do_refresh2(ChainID, State = #s{wallet = W = #wallet{poas = POAs}}) ->
check_balance(ChainID) ->
fun(This = #poa{id = ID, balances = [OldBalance]}) ->
fun(This = #poa{id = ID, balances = [#balance{coin = "gaju", total = OldBalance}]}) ->
Pucks =
case hz:acc(ID) of
{ok, #{"balance" := P}} -> P;
@ -1330,13 +1330,13 @@ read3(T) ->
do_tic(stop, State = #s{timer = none}) ->
State;
do_tic(stop, State = #s{timer = {T, _}}) ->
ok = erlang:cancel_timer(T, [{async, true}]),
_ = erlang:cancel_timer(T),
State#s{timer = none};
do_tic(MS, State = #s{timer = none}) ->
T = erlang:send_after(MS, self(), tic),
State#s{timer = {T, MS}};
do_tic(MS, State = #s{timer = {T, _}}) ->
ok = erlang:cancel_timer(T, [{async, true}]),
_ = erlang:cancel_timer(T),
T = erlang:send_after(MS, self(), tic),
State#s{timer = {T, MS}}.
@ -1358,16 +1358,21 @@ handle_tic(State = #s{wallet = This = #wallet{poas = POAs, endpoint = Node},
ok = log(info, "Balance update on tic failed with: ~p", [Error]),
State
end,
ok = erlang:cancel_timer(T, [{async, true}]),
ok = cancel_timer(T),
NewT = erlang:send_after(MS, self(), tic),
NewState#s{timer = {NewT, MS}};
handle_tic(State = #s{timer = {T, MS}}) ->
ok = erlang:cancel_timer(T, [{async, true}]),
ok = cancel_timer(T),
NewT = erlang:send_after(MS, self(), tic),
State#s{timer = {NewT, MS}};
handle_tic(State) ->
State.
cancel_timer(T) ->
case erlang:cancel_timer(T) of
false -> ok;
R -> log(warning, "Tic timers are doubled up. Remaining: ~wms", [R])
end.
persist(Prefs) ->