summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2012-10-09 13:10:47 +0100
committerSimon MacMullen <simon@rabbitmq.com>2012-10-09 13:10:47 +0100
commit578e5b166e4f535fedb106a0b974419a9a3c5c96 (patch)
tree1f221be79ab3f5f399a91a7c33b6c123ca6247d7
parentc0b7cbaf64ebf76f57cadd24b6890485aa514d8f (diff)
downloadrabbitmq-server-bug25110.tar.gz
Remove rabbit_misc:interval_operation/3, it doesn't really work.bug25110
-rw-r--r--src/rabbit_misc.erl13
1 files changed, 0 insertions, 13 deletions
diff --git a/src/rabbit_misc.erl b/src/rabbit_misc.erl
index 83ac1004..a0536a50 100644
--- a/src/rabbit_misc.erl
+++ b/src/rabbit_misc.erl
@@ -63,7 +63,6 @@
-export([version/0]).
-export([sequence_error/1]).
-export([json_encode/1, json_decode/1, json_to_term/1, term_to_json/1]).
--export([interval_operation/3]).
%% Horrible macro to use in guards
-define(IS_BENIGN_EXIT(R),
@@ -228,8 +227,6 @@
-spec(json_decode/1 :: (string()) -> {'ok', any()} | 'error').
-spec(json_to_term/1 :: (any()) -> any()).
-spec(term_to_json/1 :: (any()) -> any()).
--spec(interval_operation/3 ::
- (thunk(A), float(), non_neg_integer()) -> {A, non_neg_integer()}).
-endif.
@@ -990,13 +987,3 @@ term_to_json(L) when is_list(L) ->
term_to_json(V) when is_binary(V) orelse is_number(V) orelse V =:= null orelse
V =:= true orelse V =:= false ->
V.
-
-%% Ideally, you'd want Fun to run every IdealInterval. but you don't
-%% want it to take more than MaxRatio of IdealInterval. So if it takes
-%% more then you want to run it less often. So we time how long it
-%% takes to run, and then suggest how long you should wait before
-%% running it again. Times are in millis.
-interval_operation(Fun, MaxRatio, IdealInterval) ->
- {Micros, Res} = timer:tc(Fun),
- Ratio = lists:max([1, Micros / (MaxRatio * IdealInterval) / 1000]),
- {Res, round(IdealInterval * Ratio)}.