소스 검색

Merge pull request #8546 from thalesmg/fix-dashboard-cluster-rate

fix: dashboard monitor crash after badrpc
Thales Macedo Garitezi 3 년 전
부모
커밋
2e75c35995
1개의 변경된 파일10개의 추가작업 그리고 7개의 파일을 삭제
  1. 10 7
      apps/emqx_dashboard/src/emqx_dashboard_monitor.erl

+ 10 - 7
apps/emqx_dashboard/src/emqx_dashboard_monitor.erl

@@ -115,13 +115,16 @@ granularity_adapter(List) ->
 %% Get the current rate. Not the current sampler data.
 current_rate() ->
     Fun =
-        fun(Node, Cluster) ->
-            case current_rate(Node) of
-                {ok, CurrentRate} ->
-                    merge_cluster_rate(CurrentRate, Cluster);
-                {badrpc, Reason} ->
-                    {badrpc, {Node, Reason}}
-            end
+        fun
+            (Node, Cluster) when is_map(Cluster) ->
+                case current_rate(Node) of
+                    {ok, CurrentRate} ->
+                        merge_cluster_rate(CurrentRate, Cluster);
+                    {badrpc, Reason} ->
+                        {badrpc, {Node, Reason}}
+                end;
+            (_Node, Error) ->
+                Error
         end,
     case lists:foldl(Fun, #{}, mria_mnesia:cluster_nodes(running)) of
         {badrpc, Reason} ->