summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJean-Sébastien Pédron <jean-sebastien@rabbitmq.com>2015-08-11 18:17:14 +0200
committerJean-Sébastien Pédron <jean-sebastien@rabbitmq.com>2015-08-11 18:17:14 +0200
commitfc84a3fe8d5ebba37909f8c1e02418956b4351c1 (patch)
tree68bfa49cef656161121704c29b89890f91f3c5ae /src
parent7f3ab57c3846b98f7a8de055a384465013d02f82 (diff)
downloadrabbitmq-server-git-fc84a3fe8d5ebba37909f8c1e02418956b4351c1.tar.gz
erlang:phash2/1 returns a value in the range 0..Range-1
... but lists:nth/2 takes a position in the range 1..Length.
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_queue_location_random.erl2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/rabbit_queue_location_random.erl b/src/rabbit_queue_location_random.erl
index 6a3d1fea67..6a6f1bd913 100644
--- a/src/rabbit_queue_location_random.erl
+++ b/src/rabbit_queue_location_random.erl
@@ -40,5 +40,5 @@ description() ->
queue_master_location(#amqqueue{}) ->
Cluster = rabbit_queue_master_location_misc:all_nodes(),
RandomPos = erlang:phash2(time_compat:monotonic_time(), length(Cluster)),
- MasterNode = lists:nth(RandomPos, Cluster),
+ MasterNode = lists:nth(RandomPos + 1, Cluster),
{ok, MasterNode}.