summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFalcon Taylor-Carter <fcarter@renttherunway.com>2021-10-18 23:25:27 -0400
committerFalcon Taylor-Carter <fcarter@renttherunway.com>2021-10-18 23:25:27 -0400
commit43b10615be78dc8cb076555bf0fb579b546aee11 (patch)
tree55950c03b78de6768c8452f9309079a9145409b6
parent4dab02289df44901a597d6094ef567c1b3642d50 (diff)
downloadrabbitmq-server-git-43b10615be78dc8cb076555bf0fb579b546aee11.tar.gz
Fix binding deletion in duplicate-binding scenarios
-rw-r--r--deps/rabbitmq_consistent_hash_exchange/src/rabbit_exchange_type_consistent_hash.erl6
1 files changed, 3 insertions, 3 deletions
diff --git a/deps/rabbitmq_consistent_hash_exchange/src/rabbit_exchange_type_consistent_hash.erl b/deps/rabbitmq_consistent_hash_exchange/src/rabbit_exchange_type_consistent_hash.erl
index e9da8a63d5..48df5162cc 100644
--- a/deps/rabbitmq_consistent_hash_exchange/src/rabbit_exchange_type_consistent_hash.erl
+++ b/deps/rabbitmq_consistent_hash_exchange/src/rabbit_exchange_type_consistent_hash.erl
@@ -227,7 +227,7 @@ remove_bindings(none, X, Bindings) ->
ok.
remove_binding(#binding{source = S, destination = D, key = RK}) ->
- Weight = rabbit_data_coercion:to_integer(RK),
+ _Weight = rabbit_data_coercion:to_integer(RK),
rabbit_log:debug("Consistent hashing exchange: removing binding "
"from exchange '~p' to destination '~p' with routing key '~s'",
[rabbit_misc:rs(S), rabbit_misc:rs(D), RK]),
@@ -251,10 +251,10 @@ remove_binding(#binding{source = S, destination = D, key = RK}) ->
%% final state with "down the ring" buckets updated
NewBucketsDownTheRing = maps:fold(
fun(K0, V, Acc) ->
- maps:put(K0 - Weight, V, Acc)
+ maps:put(K0 - N, V, Acc)
end, #{}, BucketsDownTheRing),
BM1 = maps:merge(UnchangedBuckets, NewBucketsDownTheRing),
- NextN = NexN0 - Weight,
+ NextN = NexN0 - N,
State = State0#chx_hash_ring{bucket_map = BM1,
next_bucket_number = NextN},