Просмотр исходного кода

feat(http pipelining): support to switch http pipelining

zhouzb 4 лет назад
Родитель
Сommit
7d2aac7e24

+ 6 - 2
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}
-    ].
+    ].

+ 13 - 8
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.

+ 1 - 1
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"}}}