From df713959ab3c06983c1687d6ad5a2eed6c684fa0 Mon Sep 17 00:00:00 2001 From: Gilbert Wong Date: Thu, 18 Oct 2018 13:57:27 +0800 Subject: [PATCH] Refactor init_proc_mng_policy. If there is no zone, it is unnecessary to add proc_mng_policy. --- src/emqx_misc.erl | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/emqx_misc.erl b/src/emqx_misc.erl index 852113a8c..cf4a555ca 100644 --- a/src/emqx_misc.erl +++ b/src/emqx_misc.erl @@ -62,15 +62,11 @@ proc_stats(Pid) -> -define(DISABLED, 0). +init_proc_mng_policy(undefined) -> ok; init_proc_mng_policy(Zone) -> #{max_heap_size := MaxHeapSizeInBytes} = ShutdownPolicy - = case Zone of - undefined -> - #{max_heap_size => 0}; - _ -> - emqx_zone:get_env(Zone, force_shutdown_policy) - end, + = emqx_zone:get_env(Zone, force_shutdown_policy), MaxHeapSize = MaxHeapSizeInBytes div erlang:system_info(wordsize), _ = erlang:process_flag(max_heap_size, MaxHeapSize), % zero is discarded erlang:put(force_shutdown_policy, ShutdownPolicy),