Skip to content
This repository has been archived by the owner on Nov 17, 2020. It is now read-only.

Commit

Permalink
Use the new rand_compat module to transition from random to rand
Browse files Browse the repository at this point in the history
References rabbitmq/rabbitmq-server#860.
[#122335241]
  • Loading branch information
dumbbell committed Jun 29, 2016
1 parent a2e4e8c commit 8ff4eb6
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/rabbit_federation_upstream.erl
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,7 @@ remove_credentials(URI) ->
list_to_binary(amqp_uri:remove_credentials(binary_to_list(URI))).

to_params(Upstream = #upstream{uris = URIs}, XorQ) ->
random:seed(erlang:phash2([node()]),
time_compat:monotonic_time(),
time_compat:unique_integer()),
URI = lists:nth(random:uniform(length(URIs)), URIs),
URI = lists:nth(rand_compat:uniform(length(URIs)), URIs),
{ok, Params} = amqp_uri:parse(binary_to_list(URI), vhost(XorQ)),
XorQ1 = with_name(Upstream, vhost(Params), XorQ),
SafeURI = remove_credentials(URI),
Expand Down

0 comments on commit 8ff4eb6

Please sign in to comment.