Update share_sub dispatch

This commit is contained in:
turtled 2018-08-29 12:58:55 +08:00
parent 9711892f73
commit dae81037bf
1 changed files with 1 additions and 2 deletions

View File

@ -93,8 +93,7 @@ pick([]) ->
pick([SubPid]) -> pick([SubPid]) ->
SubPid; SubPid;
pick(SubPids) -> pick(SubPids) ->
X = abs(erlang:monotonic_time() bxor erlang:unique_integer()), lists:nth(rand:uniform(length(SubPids)), SubPids).
lists:nth((X rem length(SubPids)) + 1, SubPids).
subscribers(Group, Topic) -> subscribers(Group, Topic) ->
ets:select(?TAB, [{{emqx_shared_subscription, Group, Topic, '$1'}, [], ['$1']}]). ets:select(?TAB, [{{emqx_shared_subscription, Group, Topic, '$1'}, [], ['$1']}]).