Closed macpie closed 4 months ago
Full refresh
f(),
F = fun() ->
RouteIDs = [hpr_route:id(R) || R <- hpr_route_storage:all_routes()],
Total = length(RouteIDs),
TimeIt = fun(Func) ->
{Time0, Val} = timer:tc(Func),
Time = erlang:convert_time_unit(Time0, microsecond, millisecond),
io:format("took ~pms~n", [Time]),
Val
end,
Refresh = fun({Idx, ID}) ->
io:format("~n~p/~p===========================================================~n", [Idx, Total]),
TimeIt(fun() ->
try hpr_route_stream_worker:refresh_route(ID) of
{ok, Map} ->
io:format("| Type | Before | After | Removed | Added |~n"),
io:format("|------|--------|-------|---------|-------|~n"),
io:format("| ~4w | ~6w | ~5w | ~7w | ~5w |~n", [eui, maps:get(eui_before, Map), maps:get(eui_after, Map), maps:get(eui_removed, Map), maps:get(eui_added, Map)]),
io:format("| ~4w | ~6w | ~5w | ~7w | ~5w |~n", [skf, maps:get(skf_before, Map), maps:get(skf_after, Map), maps:get(skf_removed, Map), maps:get(skf_added, Map)]),
io:format("| ~4w | ~6w | ~5w | ~7w | ~5w |~n", [addr, maps:get(devaddr_before, Map), maps:get(devaddr_after, Map), maps:get(devaddr_removed, Map), maps:get(devaddr_added, Map)]);
{error, _R} ->
io:format("ERROR ~p~n", [_R])
catch
_E:_R ->
io:format("CRASHED ~p~n", [_R])
end
end)
end,
[Refresh(ID) || ID <- lists:zip(lists:seq(1, Total), RouteIDs)]
end,
F().
It seems like refresh a route does not work.
Running this:
hpr config route refresh
and then this in a shell:
show that nothing really changed