Fix the 'function_clause' error when session is undefined
This commit is contained in:
parent
a1877f3f42
commit
53dda48833
|
@ -153,6 +153,8 @@ attrs(session, #channel{session = Session}) ->
|
||||||
attrs(Key, Channel) -> info(Key, Channel).
|
attrs(Key, Channel) -> info(Key, Channel).
|
||||||
|
|
||||||
-spec(stats(channel()) -> emqx_types:stats()).
|
-spec(stats(channel()) -> emqx_types:stats()).
|
||||||
|
stats(#channel{pub_stats = PubStats, session = undefined}) ->
|
||||||
|
maps:to_list(PubStats);
|
||||||
stats(#channel{pub_stats = PubStats, session = Session}) ->
|
stats(#channel{pub_stats = PubStats, session = Session}) ->
|
||||||
maps:to_list(PubStats) ++ emqx_session:stats(Session).
|
maps:to_list(PubStats) ++ emqx_session:stats(Session).
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue