From 7d2aac7e24fa19a14ee28dc7489ee456082d751e Mon Sep 17 00:00:00 2001 From: zhouzb Date: Wed, 21 Jul 2021 11:32:38 +0800 Subject: [PATCH] feat(http pipelining): support to switch http pipelining --- apps/emqx_authn/src/emqx_authn_api.erl | 8 +++++-- .../src/emqx_connector_http.erl | 21 ++++++++++++------- rebar.config | 2 +- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/apps/emqx_authn/src/emqx_authn_api.erl b/apps/emqx_authn/src/emqx_authn_api.erl index de2755bef..561f69861 100644 --- a/apps/emqx_authn/src/emqx_authn_api.erl +++ b/apps/emqx_authn/src/emqx_authn_api.erl @@ -92,7 +92,7 @@ authenticator_api() -> } } }, - {"/authentication/authenticators", Metadata, clients}. + {"/authentication/authenticators", Metadata, authenticators}. definitions() -> AuthenticatorDef = #{ @@ -361,6 +361,10 @@ definitions() -> pool_size => #{ type => integer, default => 8 + }, + enable_pipelining => #{ + type => boolean, + default => true } } }, @@ -426,4 +430,4 @@ definitions() -> , #{<<"password_based_http_server">> => PasswordBasedHTTPServerDef} , #{<<"password_hash_algorithm">> => PasswordHashAlgorithmDef} , #{<<"ssl">> => SSLDef} - ]. \ No newline at end of file + ]. diff --git a/apps/emqx_connector/src/emqx_connector_http.erl b/apps/emqx_connector/src/emqx_connector_http.erl index 30480eb35..11860f32d 100644 --- a/apps/emqx_connector/src/emqx_connector_http.erl +++ b/apps/emqx_connector/src/emqx_connector_http.erl @@ -53,14 +53,15 @@ fields("") -> [{config, #{type => hoconsc:ref(?MODULE, config)}}]; fields(config) -> - [ {base_url, fun base_url/1} - , {connect_timeout, fun connect_timeout/1} - , {max_retries, fun max_retries/1} - , {retry_interval, fun retry_interval/1} - , {pool_type, fun pool_type/1} - , {pool_size, fun pool_size/1} - , {ssl_opts, #{type => hoconsc:ref(?MODULE, ssl_opts), - default => #{}}} + [ {base_url, fun base_url/1} + , {connect_timeout, fun connect_timeout/1} + , {max_retries, fun max_retries/1} + , {retry_interval, fun retry_interval/1} + , {pool_type, fun pool_type/1} + , {pool_size, fun pool_size/1} + , {enable_pipelining, fun enable_pipelining/1} + , {ssl_opts, #{type => hoconsc:ref(?MODULE, ssl_opts), + default => #{}}} ]; fields(ssl_opts) -> @@ -101,6 +102,10 @@ pool_size(type) -> non_neg_integer(); pool_size(default) -> 8; pool_size(_) -> undefined. +enable_pipelining(type) -> boolean(); +enable_pipelining(default) -> true; +enable_pipelining(_) -> undefined. + cacertfile(type) -> string(); cacertfile(nullable) -> true; cacertfile(_) -> undefined. diff --git a/rebar.config b/rebar.config index 66d8b8f27..cdbf1869a 100644 --- a/rebar.config +++ b/rebar.config @@ -43,7 +43,7 @@ {deps, [ {gpb, "4.11.2"} %% gpb only used to build, but not for release, pin it here to avoid fetching a wrong version due to rebar plugins scattered in all the deps - , {ehttpc, {git, "https://github.com/emqx/ehttpc", {tag, "0.1.7"}}} + , {ehttpc, {git, "https://github.com/emqx/ehttpc", {tag, "0.1.8"}}} , {gproc, {git, "https://github.com/uwiger/gproc", {tag, "0.8.0"}}} , {jiffy, {git, "https://github.com/emqx/jiffy", {tag, "1.0.5"}}} , {cowboy, {git, "https://github.com/emqx/cowboy", {tag, "2.8.2"}}}