feat(connector-http): using pos_integer() instead of boolean() for enable_pipelining
This commit is contained in:
parent
f6e53c7f55
commit
ebf4ed0270
|
@ -76,12 +76,12 @@ base URL 只包含host和port。</br>
|
||||||
|
|
||||||
enable_pipelining {
|
enable_pipelining {
|
||||||
desc {
|
desc {
|
||||||
en: "Enable the HTTP pipeline."
|
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管道。"
|
zh: "是否连续发送 HTTP 请求,当设置为 0 时,表示每次发送完成 HTTP 请求后都需要等待服务器返回,再继续发送下一个请求。"
|
||||||
}
|
}
|
||||||
label: {
|
label: {
|
||||||
en: "HTTP Pipelineing"
|
en: "HTTP Pipelineing"
|
||||||
zh: "HTTP管道"
|
zh: "HTTP 管道"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,8 @@
|
||||||
pool_type/0
|
pool_type/0
|
||||||
]).
|
]).
|
||||||
|
|
||||||
|
-define(DEFAULT_PIPELINE_SIZE, 100).
|
||||||
|
|
||||||
%%=====================================================================
|
%%=====================================================================
|
||||||
%% Hocon schema
|
%% Hocon schema
|
||||||
|
|
||||||
|
@ -120,9 +122,9 @@ fields(config) ->
|
||||||
)},
|
)},
|
||||||
{enable_pipelining,
|
{enable_pipelining,
|
||||||
sc(
|
sc(
|
||||||
boolean(),
|
pos_integer(),
|
||||||
#{
|
#{
|
||||||
default => true,
|
default => ?DEFAULT_PIPELINE_SIZE,
|
||||||
desc => ?DESC("enable_pipelining")
|
desc => ?DESC("enable_pipelining")
|
||||||
}
|
}
|
||||||
)},
|
)},
|
||||||
|
@ -210,7 +212,8 @@ on_start(
|
||||||
{pool_type, PoolType},
|
{pool_type, PoolType},
|
||||||
{pool_size, PoolSize},
|
{pool_size, PoolSize},
|
||||||
{transport, Transport},
|
{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),
|
PoolName = emqx_plugin_libs_pool:pool_name(InstId),
|
||||||
State = #{
|
State = #{
|
||||||
|
|
Loading…
Reference in New Issue