fix: make resume_interval defaults to health_check_interval

This commit is contained in:
Shawn 2022-08-16 10:09:02 +08:00
parent de3a325953
commit 9e35032d78
5 changed files with 20 additions and 2 deletions

View File

@ -34,6 +34,8 @@ fields("creation_opts") ->
desc("config") -> desc("config") ->
?DESC("desc_config"); ?DESC("desc_config");
desc("creation_opts") ->
?DESC(emqx_resource_schema, "creation_opts");
desc(Method) when Method =:= "get"; Method =:= "put"; Method =:= "post" -> desc(Method) when Method =:= "get"; Method =:= "put"; Method =:= "post" ->
["Configuration for WebHook using `", string:to_upper(Method), "` method."]; ["Configuration for WebHook using `", string:to_upper(Method), "` method."];
desc(_) -> desc(_) ->

View File

@ -1,4 +1,5 @@
emqx_resource_schema { emqx_resource_schema {
resource_opts { resource_opts {
desc { desc {
en: """Resource options.""" en: """Resource options."""
@ -10,6 +11,17 @@ emqx_resource_schema {
} }
} }
creation_opts {
desc {
en: """Creation options."""
zh: """资源启动相关的选项。"""
}
label {
en: """Creation Options"""
zh: """资源启动选项"""
}
}
health_check_interval { health_check_interval {
desc { desc {
en: """Health check interval, in milliseconds.""" en: """Health check interval, in milliseconds."""

View File

@ -66,6 +66,7 @@
enable_queue => boolean(), enable_queue => boolean(),
queue_max_bytes => integer(), queue_max_bytes => integer(),
query_mode => async | sync | dynamic, query_mode => async | sync | dynamic,
resume_interval => integer(),
async_inflight_window => integer() async_inflight_window => integer()
}. }.
-type query_result() :: -type query_result() ::

View File

@ -135,7 +135,7 @@ init({Id, Index, Opts}) ->
batch_size => BatchSize, batch_size => BatchSize,
batch_time => maps:get(batch_time, Opts, ?DEFAULT_BATCH_TIME), batch_time => maps:get(batch_time, Opts, ?DEFAULT_BATCH_TIME),
queue => Queue, queue => Queue,
resume_interval => maps:get(health_check_interval, Opts, ?HEALTHCHECK_INTERVAL), resume_interval => maps:get(resume_interval, Opts, ?HEALTHCHECK_INTERVAL),
acc => [], acc => [],
acc_left => BatchSize, acc_left => BatchSize,
tref => undefined tref => undefined

View File

@ -21,7 +21,7 @@
-import(hoconsc, [mk/2, enum/1, ref/2]). -import(hoconsc, [mk/2, enum/1, ref/2]).
-export([namespace/0, roots/0, fields/1]). -export([namespace/0, roots/0, fields/1, desc/1]).
%% ------------------------------------------------------------------------------------------------- %% -------------------------------------------------------------------------------------------------
%% Hocon Schema Definitions %% Hocon Schema Definitions
@ -122,3 +122,6 @@ queue_max_bytes(desc) -> ?DESC("queue_max_bytes");
queue_max_bytes(default) -> ?DEFAULT_QUEUE_SIZE_RAW; queue_max_bytes(default) -> ?DEFAULT_QUEUE_SIZE_RAW;
queue_max_bytes(required) -> false; queue_max_bytes(required) -> false;
queue_max_bytes(_) -> undefined. queue_max_bytes(_) -> undefined.
desc("creation_opts") ->
?DESC("creation_opts").