@@ -1290,43 +1290,22 @@ status(Vhost, QueueName) ->
12901290 {<<" Term" >>, <<>>},
12911291 {<<" Machine Version" >>, MacVer }
12921292 ];
1293- {error , _ } ->
1294- % % try the old method
1295- case get_sys_status (ServerId ) of
1296- {ok , Sys } ->
1297- {_ , M } = lists :keyfind (ra_server_state , 1 , Sys ),
1298- {_ , RaftState } = lists :keyfind (raft_state , 1 , Sys ),
1299- #{commit_index := Commit ,
1300- machine_version := MacVer ,
1301- current_term := Term ,
1302- last_applied := LastApplied ,
1303- log := #{last_index := Last ,
1304- last_written_index_term := {LastWritten , _ },
1305- snapshot_index := SnapIdx }} = M ,
1306- [{<<" Node Name" >>, N },
1307- {<<" Raft State" >>, RaftState },
1308- {<<" Membership" >>, voter },
1309- {<<" Last Log Index" >>, Last },
1310- {<<" Last Written" >>, LastWritten },
1311- {<<" Last Applied" >>, LastApplied },
1312- {<<" Commit Index" >>, Commit },
1313- {<<" Snapshot Index" >>, SnapIdx },
1314- {<<" Term" >>, Term },
1315- {<<" Machine Version" >>, MacVer }
1316- ];
1317- {error , Err } ->
1318- [{<<" Node Name" >>, N },
1319- {<<" Raft State" >>, Err },
1320- {<<" Membership" >>, <<>>},
1321- {<<" Last Log Index" >>, <<>>},
1322- {<<" Last Written" >>, <<>>},
1323- {<<" Last Applied" >>, <<>>},
1324- {<<" Commit Index" >>, <<>>},
1325- {<<" Snapshot Index" >>, <<>>},
1326- {<<" Term" >>, <<>>},
1327- {<<" Machine Version" >>, <<>>}
1328- ]
1329- end
1293+ {error , Reason } ->
1294+ State = case is_atom (Reason ) of
1295+ true -> Reason ;
1296+ false -> unknown
1297+ end ,
1298+ [{<<" Node Name" >>, N },
1299+ {<<" Raft State" >>, State },
1300+ {<<" Membership" >>, <<>>},
1301+ {<<" Last Log Index" >>, <<>>},
1302+ {<<" Last Written" >>, <<>>},
1303+ {<<" Last Applied" >>, <<>>},
1304+ {<<" Commit Index" >>, <<>>},
1305+ {<<" Snapshot Index" >>, <<>>},
1306+ {<<" Term" >>, <<>>},
1307+ {<<" Machine Version" >>, <<>>}
1308+ ]
13301309 end
13311310 end || N <- Nodes ];
13321311 {ok , _Q } ->
@@ -1335,17 +1314,6 @@ status(Vhost, QueueName) ->
13351314 E
13361315 end .
13371316
1338- get_sys_status (Proc ) ->
1339- try lists :nth (5 , element (4 , sys :get_status (Proc ))) of
1340- Sys -> {ok , Sys }
1341- catch
1342- _ :Err when is_tuple (Err ) ->
1343- {error , element (1 , Err )};
1344- _ :_ ->
1345- {error , other }
1346-
1347- end .
1348-
13491317add_member (VHost , Name , Node , Membership , Timeout )
13501318 when is_binary (VHost ) andalso
13511319 is_binary (Name ) andalso
0 commit comments