Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:26
rabbitmq-stomp
0001-clean-up-workarounds-for-Erlang-OTP-18.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0001-clean-up-workarounds-for-Erlang-OTP-18.patch of Package rabbitmq-stomp
From 1727e6f6d1d59eef05dbd77f73d728d70b61d0c5 Mon Sep 17 00:00:00 2001 From: Led <ledest@gmail.com> Date: Fri, 18 Aug 2017 15:44:19 +0300 Subject: [PATCH] clean up workarounds for Erlang/OTP < 18 --- src/rabbit_stomp_util.erl | 6 +----- test/src/rabbit_stomp_publish_test.erl | 23 +++++++++-------------- 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/src/rabbit_stomp_util.erl b/src/rabbit_stomp_util.erl index 2d794f7..5a1de7c 100644 --- a/src/rabbit_stomp_util.erl +++ b/src/rabbit_stomp_util.erl @@ -373,11 +373,7 @@ subscription_queue_name(Destination, SubscriptionId, Frame) -> %% Destination and SubscriptionId, and b) meets the constraints on %% AMQP queue names. It doesn't need to be secure; we use md5 here %% simply as a convenient means to bound the length. - rabbit_guid:string( - erlang:md5( - term_to_binary_compat:term_to_binary_1( - {Destination, SubscriptionId})), - "stomp-subscription"); + rabbit_guid:string(erlang:md5(term_to_binary({Destination, SubscriptionId})), "stomp-subscription"); Name -> Name end. diff --git a/test/src/rabbit_stomp_publish_test.erl b/test/src/rabbit_stomp_publish_test.erl index 6ad509e..839d460 100644 --- a/test/src/rabbit_stomp_publish_test.erl +++ b/test/src/rabbit_stomp_publish_test.erl @@ -34,14 +34,14 @@ run() -> [put(K, 0) || K <- [sent, recd, last_sent, last_recd]], - put(last_ts, time_compat:monotonic_time()), + put(last_ts, erlang:monotonic_time()), {ok, Pub} = rabbit_stomp_client:connect(), {ok, Recv} = rabbit_stomp_client:connect(), Self = self(), - spawn(fun() -> publish(Self, Pub, 0, time_compat:monotonic_time()) end), + spawn(fun() -> publish(Self, Pub, 0, erlang:monotonic_time()) end), rabbit_stomp_client:send( Recv, "SUBSCRIBE", [{"destination", ?DESTINATION}]), - spawn(fun() -> recv(Self, Recv, 0, time_compat:monotonic_time()) end), + spawn(fun() -> recv(Self, Recv, 0, erlang:monotonic_time()) end), report(). report() -> @@ -49,14 +49,13 @@ report() -> {sent, C} -> put(sent, C); {recd, C} -> put(recd, C) end, - Diff = time_compat:convert_time_unit( - time_compat:monotonic_time() - get(last_ts), native, microseconds), + Diff = erlang:convert_time_unit(erlang:monotonic_time() - get(last_ts), native, microseconds), case Diff > ?MICROS_PER_UPDATE of true -> S = get(sent) - get(last_sent), R = get(recd) - get(last_recd), put(last_sent, get(sent)), put(last_recd, get(recd)), - put(last_ts, time_compat:monotonic_time()), + put(last_ts, erlang:monotonic_time()), io:format("Send ~p msg/s | Recv ~p msg/s~n", [trunc(S * ?MICROS_PER_SECOND / Diff), trunc(R * ?MICROS_PER_SECOND / Diff)]); @@ -68,12 +67,10 @@ publish(Owner, Client, Count, TS) -> rabbit_stomp_client:send( Client, "SEND", [{"destination", ?DESTINATION}], [integer_to_list(Count)]), - Diff = time_compat:convert_time_unit( - time_compat:monotonic_time() - TS, native, microseconds), + Diff = erlang:convert_time_unit(erlang:monotonic_time() - TS, native, microseconds), case Diff > ?MICROS_PER_UPDATE_MSG of true -> Owner ! {sent, Count + 1}, - publish(Owner, Client, Count + 1, - time_compat:monotonic_time()); + publish(Owner, Client, Count + 1, erlang:monotonic_time()); false -> publish(Owner, Client, Count + 1, TS) end. @@ -82,12 +79,10 @@ recv(Owner, Client0, Count, TS) -> rabbit_stomp_client:recv(Client0), BodyInt = list_to_integer(binary_to_list(iolist_to_binary(Body))), Count = BodyInt, - Diff = time_compat:convert_time_unit( - time_compat:monotonic_time() - TS, native, microseconds), + Diff = erlang:convert_time_unit(erlang:monotonic_time() - TS, native, microseconds), case Diff > ?MICROS_PER_UPDATE_MSG of true -> Owner ! {recd, Count + 1}, - recv(Owner, Client1, Count + 1, - time_compat:monotonic_time()); + recv(Owner, Client1, Count + 1, erlang:monotonic_time()); false -> recv(Owner, Client1, Count + 1, TS) end. -- 2.14.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor