fix(management): make client format function durable
This commit is contained in:
parent
b68a0b3730
commit
d628c49f16
|
@ -866,7 +866,11 @@ item(client, {ClientId, ChanPid}) ->
|
||||||
end,
|
end,
|
||||||
ClientInfo = maps:get(clientinfo, Attrs, #{}),
|
ClientInfo = maps:get(clientinfo, Attrs, #{}),
|
||||||
ConnInfo = maps:get(conninfo, Attrs, #{}),
|
ConnInfo = maps:get(conninfo, Attrs, #{}),
|
||||||
Session = maps:get(session, Attrs, #{}),
|
Session = case maps:get(session, Attrs, #{}) of
|
||||||
|
undefined -> #{};
|
||||||
|
_Sess -> _Sess
|
||||||
|
end,
|
||||||
|
SessCreated = maps:get(created_at, Session, maps:get(connected_at, ConnInfo)),
|
||||||
Connected = case maps:get(conn_state, Attrs) of
|
Connected = case maps:get(conn_state, Attrs) of
|
||||||
connected -> true;
|
connected -> true;
|
||||||
_ -> false
|
_ -> false
|
||||||
|
@ -889,7 +893,7 @@ item(client, {ClientId, ChanPid}) ->
|
||||||
maps:with([clientid, username, mountpoint, is_bridge, zone], ClientInfo),
|
maps:with([clientid, username, mountpoint, is_bridge, zone], ClientInfo),
|
||||||
maps:with([clean_start, keepalive, expiry_interval, proto_name,
|
maps:with([clean_start, keepalive, expiry_interval, proto_name,
|
||||||
proto_ver, peername, connected_at, disconnected_at], ConnInfo),
|
proto_ver, peername, connected_at, disconnected_at], ConnInfo),
|
||||||
maps:with([created_at], Session)]);
|
#{created_at => SessCreated}]);
|
||||||
|
|
||||||
item(subscription, {{Topic, ClientId}, Options}) ->
|
item(subscription, {{Topic, ClientId}, Options}) ->
|
||||||
#{topic => Topic, clientid => ClientId, options => Options};
|
#{topic => Topic, clientid => ClientId, options => Options};
|
||||||
|
|
Loading…
Reference in New Issue