Add suboptions for stats (#2507)
This commit is contained in:
parent
0ea6697a57
commit
b4c659fb54
|
@ -73,6 +73,8 @@
|
|||
-define(PUBSUB_STATS, [
|
||||
'topics/count',
|
||||
'topics/max',
|
||||
'suboptions/count',
|
||||
'suboptions/max',
|
||||
'subscribers/count',
|
||||
'subscribers/max',
|
||||
'subscriptions/count',
|
||||
|
@ -242,9 +244,12 @@ code_change(_OldVsn, State, _Extra) ->
|
|||
%%------------------------------------------------------------------------------
|
||||
|
||||
safe_update_element(Key, Val) ->
|
||||
try ets:update_element(?TAB, Key, {2, Val})
|
||||
try ets:update_element(?TAB, Key, {2, Val}) of
|
||||
false ->
|
||||
ets:insert_new(?TAB, {Key, Val});
|
||||
true ->
|
||||
true
|
||||
catch
|
||||
error:badarg ->
|
||||
ets:insert_new(?TAB, {Key, Val})
|
||||
?LOG(warning, "[Stats] Update ~p to ~p failed", [Key, Val])
|
||||
end.
|
||||
|
||||
|
|
Loading…
Reference in New Issue