Use phash2() and the new Time API as a random seed
References rabbitmq/rabbitmq-server#233.
This commit is contained in:
parent
ff0781f71d
commit
d05b8fd0d1
|
|
@ -71,7 +71,9 @@ remove_credentials(URI) ->
|
|||
list_to_binary(amqp_uri:remove_credentials(binary_to_list(URI))).
|
||||
|
||||
to_params(Upstream = #upstream{uris = URIs}, XorQ) ->
|
||||
random:seed(now()),
|
||||
random:seed(erlang:phash2([node()]),
|
||||
time_compat:monotonic_time(),
|
||||
time_compat:unique_integer()),
|
||||
URI = lists:nth(random:uniform(length(URIs)), URIs),
|
||||
{ok, Params} = amqp_uri:parse(binary_to_list(URI), vhost(XorQ)),
|
||||
XorQ1 = with_name(Upstream, vhost(Params), XorQ),
|
||||
|
|
|
|||
Loading…
Reference in New Issue