refactor: delete stale code
'hash' strategy has been removed from config schema hence no need to keep the compatibility code
This commit is contained in:
parent
ad3a793910
commit
e932569f34
|
@ -81,8 +81,6 @@
|
||||||
| round_robin_per_group
|
| round_robin_per_group
|
||||||
| sticky
|
| sticky
|
||||||
| local
|
| local
|
||||||
%% same as hash_clientid, backward compatible
|
|
||||||
| hash
|
|
||||||
| hash_clientid
|
| hash_clientid
|
||||||
| hash_topic.
|
| hash_topic.
|
||||||
|
|
||||||
|
@ -360,9 +358,6 @@ pick_subscriber(Group, Topic, Strategy, ClientId, SourceTopic, Subs) ->
|
||||||
|
|
||||||
do_pick_subscriber(_Group, _Topic, random, _ClientId, _SourceTopic, Count) ->
|
do_pick_subscriber(_Group, _Topic, random, _ClientId, _SourceTopic, Count) ->
|
||||||
rand:uniform(Count);
|
rand:uniform(Count);
|
||||||
do_pick_subscriber(Group, Topic, hash, ClientId, SourceTopic, Count) ->
|
|
||||||
%% backward compatible
|
|
||||||
do_pick_subscriber(Group, Topic, hash_clientid, ClientId, SourceTopic, Count);
|
|
||||||
do_pick_subscriber(_Group, _Topic, hash_clientid, ClientId, _SourceTopic, Count) ->
|
do_pick_subscriber(_Group, _Topic, hash_clientid, ClientId, _SourceTopic, Count) ->
|
||||||
1 + erlang:phash2(ClientId) rem Count;
|
1 + erlang:phash2(ClientId) rem Count;
|
||||||
do_pick_subscriber(_Group, _Topic, hash_topic, _ClientId, SourceTopic, Count) ->
|
do_pick_subscriber(_Group, _Topic, hash_topic, _ClientId, SourceTopic, Count) ->
|
||||||
|
|
|
@ -378,8 +378,8 @@ t_sticky_unsubscribe(Config) when is_list(Config) ->
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
t_hash(Config) when is_list(Config) ->
|
t_hash(Config) when is_list(Config) ->
|
||||||
ok = ensure_config(hash, false),
|
ok = ensure_config(hash_clientid, false),
|
||||||
test_two_messages(hash).
|
test_two_messages(hash_clientid).
|
||||||
|
|
||||||
t_hash_clinetid(Config) when is_list(Config) ->
|
t_hash_clinetid(Config) when is_list(Config) ->
|
||||||
ok = ensure_config(hash_clientid, false),
|
ok = ensure_config(hash_clientid, false),
|
||||||
|
@ -486,7 +486,7 @@ test_two_messages(Strategy, Group) ->
|
||||||
sticky -> ?assertEqual(UsedSubPid1, UsedSubPid2);
|
sticky -> ?assertEqual(UsedSubPid1, UsedSubPid2);
|
||||||
round_robin -> ?assertNotEqual(UsedSubPid1, UsedSubPid2);
|
round_robin -> ?assertNotEqual(UsedSubPid1, UsedSubPid2);
|
||||||
round_robin_per_group -> ?assertNotEqual(UsedSubPid1, UsedSubPid2);
|
round_robin_per_group -> ?assertNotEqual(UsedSubPid1, UsedSubPid2);
|
||||||
hash -> ?assertEqual(UsedSubPid1, UsedSubPid2);
|
hash_clientid -> ?assertEqual(UsedSubPid1, UsedSubPid2);
|
||||||
_ -> ok
|
_ -> ok
|
||||||
end,
|
end,
|
||||||
ok.
|
ok.
|
||||||
|
|
Loading…
Reference in New Issue