Merge pull request #8091 from HJianBo/changes-enable_pipelining-type

feat(connector-http): using pos_integer() instead of boolean() for enable_pipelining
This commit is contained in:
JianBo He 2022-05-31 20:49:35 +08:00 committed by GitHub
commit 020c612b46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 8 deletions

View File

@ -1406,7 +1406,7 @@ authenticator_examples() ->
pool_size => 8,
connect_timeout => 5000,
request_timeout => 5000,
enable_pipelining => true,
enable_pipelining => 100,
ssl => #{enable => false}
}
},

View File

@ -228,7 +228,7 @@ info_example_basic(webhook, _) ->
retry_interval => <<"10s">>,
pool_type => <<"random">>,
pool_size => 4,
enable_pipelining => true,
enable_pipelining => 100,
ssl => #{enable => false},
local_topic => <<"emqx_webhook/#">>,
method => post,

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 = #{