diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_resource_monitor_misc.erl | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/rabbit_resource_monitor_misc.erl b/src/rabbit_resource_monitor_misc.erl index 88f3bd1121..f90b8ce310 100644 --- a/src/rabbit_resource_monitor_misc.erl +++ b/src/rabbit_resource_monitor_misc.erl @@ -30,10 +30,12 @@ parse_information_unit(Value) when is_integer(Value) -> {ok, Value}; parse_information_unit(Value) when is_list(Value) -> case re:run(Value, "^(?<VAL>[0-9]+)(?<UNIT>kB|KB|MB|GB|kb|mb|gb|Kb|Mb|Gb|kiB|KiB|MiB|GiB|kib|mib|gib|KIB|MIB|GIB|k|K|m|M|g|G)?$", - [{capture, all_names, list}]) of + [{capture, all_but_first, list}]) of {match, [[], _]} -> {ok, list_to_integer(Value)}; - {match, [Unit, Num]} -> + {match, [Num]} -> + {ok, list_to_integer(Num)}; + {match, [Num, Unit]} -> Multiplier = case Unit of KiB when KiB =:= "k"; KiB =:= "kiB"; KiB =:= "K"; KiB =:= "KIB"; KiB =:= "kib" -> 1024; MiB when MiB =:= "m"; MiB =:= "MiB"; MiB =:= "M"; MiB =:= "MIB"; MiB =:= "mib" -> 1024*1024; |
