feat(connector-http): using pos_integer() instead of boolean() for enable_pipelining

This commit is contained in:
JianBo He 2022-05-31 17:14:59 +08:00
parent f6e53c7f55
commit ebf4ed0270
2 changed files with 9 additions and 6 deletions

View File

@ -76,12 +76,12 @@ base URL 只包含host和port。</br>
enable_pipelining {
desc {
en: "Enable the HTTP pipeline."
zh: "允许HTTP管道。"
en: "Whether to send HTTP requests continuously, when set to 0, it means that after each HTTP request is sent, you need to wait for the server to return and then continue to send the next request."
zh: "是否连续发送 HTTP 请求,当设置为 0 时,表示每次发送完成 HTTP 请求后都需要等待服务器返回,再继续发送下一个请求。"
}
label: {
en: "HTTP Pipelineing"
zh: "HTTP管道"
zh: "HTTP 管道"
}
}

View File

@ -54,6 +54,8 @@
pool_type/0
]).
-define(DEFAULT_PIPELINE_SIZE, 100).
%%=====================================================================
%% Hocon schema
@ -120,9 +122,9 @@ fields(config) ->
)},
{enable_pipelining,
sc(
boolean(),
pos_integer(),
#{
default => true,
default => ?DEFAULT_PIPELINE_SIZE,
desc => ?DESC("enable_pipelining")
}
)},
@ -210,7 +212,8 @@ on_start(
{pool_type, PoolType},
{pool_size, PoolSize},
{transport, Transport},
{transport_opts, NTransportOpts}
{transport_opts, NTransportOpts},
{enable_pipelining, maps:get(enable_pipelining, Config, ?DEFAULT_PIPELINE_SIZE)}
],
PoolName = emqx_plugin_libs_pool:pool_name(InstId),
State = #{