diff options
author | Simon MacMullen <simon@rabbitmq.com> | 2012-10-09 13:10:47 +0100 |
---|---|---|
committer | Simon MacMullen <simon@rabbitmq.com> | 2012-10-09 13:10:47 +0100 |
commit | 578e5b166e4f535fedb106a0b974419a9a3c5c96 (patch) | |
tree | 1f221be79ab3f5f399a91a7c33b6c123ca6247d7 | |
parent | c0b7cbaf64ebf76f57cadd24b6890485aa514d8f (diff) | |
download | rabbitmq-server-bug25110.tar.gz |
Remove rabbit_misc:interval_operation/3, it doesn't really work.bug25110
-rw-r--r-- | src/rabbit_misc.erl | 13 |
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)}. |