fix(force-shutdown-policy): default to enable force_shutdown_policy

This commit is contained in:
turtled 2020-09-30 08:35:24 +08:00
parent da4d71917f
commit 048e510dde
2 changed files with 14 additions and 2 deletions

View File

@ -730,7 +730,7 @@ zone.external.force_gc_policy = 16000|16MB
## of queued MQTT messages of QoS 1 and 2.
##
## Numbers delimited by `|'. Zero or negative is to disable.
## zone.external.force_shutdown_policy = 32000|32MB
zone.external.force_shutdown_policy = 10000|32MB
## Maximum MQTT packet size allowed.
##
@ -982,7 +982,7 @@ zone.internal.mqueue_store_qos0 = true
zone.internal.enable_flapping_detect = off
## See zone.$name.force_shutdown_policy
## zone.internal.force_shutdown_policy = 128000|128MB
zone.internal.force_shutdown_policy = 128000|64MB
## All the topics will be prefixed with the mountpoint path if this option is enabled.
##

View File

@ -1026,6 +1026,7 @@ end}.
%% of queued MQTT messages of QoS 1 and 2.
%% Zero or negative is to disable.
{mapping, "zone.$name.force_shutdown_policy", "emqx.zones", [
{default, "default"},
{datatype, string}
]}.
@ -1082,6 +1083,17 @@ end}.
count => list_to_integer(Count)}
end,
{force_gc_policy, GcPolicy};
(["force_shutdown_policy"], "default") ->
{DefaultLen, DefaultSize} =
case WordSize = erlang:system_info(wordsize) of
8 -> % arch_64
{10000, cuttlefish_bytesize:parse("32MB")};
4 -> % arch_32
{10000, cuttlefish_bytesize:parse("16MB")}
end,
{force_shutdown_policy, #{message_queue_len => DefaultLen,
max_heap_size => DefaultSize div WordSize
}};
(["force_shutdown_policy"], Val) ->
[Len, Siz] = string:tokens(Val, "| "),
MaxSiz = case WordSize = erlang:system_info(wordsize) of