Refactor init_proc_mng_policy.
If there is no zone, it is unnecessary to add proc_mng_policy.
This commit is contained in:
parent
a748e8f1d8
commit
df713959ab
|
@ -62,15 +62,11 @@ proc_stats(Pid) ->
|
||||||
|
|
||||||
-define(DISABLED, 0).
|
-define(DISABLED, 0).
|
||||||
|
|
||||||
|
init_proc_mng_policy(undefined) -> ok;
|
||||||
init_proc_mng_policy(Zone) ->
|
init_proc_mng_policy(Zone) ->
|
||||||
#{max_heap_size := MaxHeapSizeInBytes}
|
#{max_heap_size := MaxHeapSizeInBytes}
|
||||||
= ShutdownPolicy
|
= ShutdownPolicy
|
||||||
= case Zone of
|
= emqx_zone:get_env(Zone, force_shutdown_policy),
|
||||||
undefined ->
|
|
||||||
#{max_heap_size => 0};
|
|
||||||
_ ->
|
|
||||||
emqx_zone:get_env(Zone, force_shutdown_policy)
|
|
||||||
end,
|
|
||||||
MaxHeapSize = MaxHeapSizeInBytes div erlang:system_info(wordsize),
|
MaxHeapSize = MaxHeapSizeInBytes div erlang:system_info(wordsize),
|
||||||
_ = erlang:process_flag(max_heap_size, MaxHeapSize), % zero is discarded
|
_ = erlang:process_flag(max_heap_size, MaxHeapSize), % zero is discarded
|
||||||
erlang:put(force_shutdown_policy, ShutdownPolicy),
|
erlang:put(force_shutdown_policy, ShutdownPolicy),
|
||||||
|
|
Loading…
Reference in New Issue