Merge pull request #12183 from zmstone/1215-chore-upgrade-ehttpc

chore: upgrade gun and ehttpc
This commit is contained in:
Zaiming (Stone) Shi 2023-12-21 22:02:22 +01:00 committed by GitHub
commit a53d293bde
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 10 deletions

View File

@ -428,7 +428,8 @@ do_get_status(ResourceId, Timeout) ->
msg => "ehttpc_health_check_failed", msg => "ehttpc_health_check_failed",
connector => ResourceId, connector => ResourceId,
reason => Reason, reason => Reason,
worker => Worker worker => Worker,
wait_time => Timeout
}), }),
false false
end end

View File

@ -310,7 +310,7 @@ gcp_pubsub_config(Config) ->
io_lib:format( io_lib:format(
"bridges.gcp_pubsub.~s {\n" "bridges.gcp_pubsub.~s {\n"
" enable = true\n" " enable = true\n"
" connect_timeout = 1s\n" " connect_timeout = 5s\n"
" service_account_json = ~s\n" " service_account_json = ~s\n"
" payload_template = ~p\n" " payload_template = ~p\n"
" pubsub_topic = ~s\n" " pubsub_topic = ~s\n"
@ -1404,8 +1404,23 @@ t_failure_no_body(Config) ->
), ),
ok. ok.
kill_gun_process(EhttpcPid) ->
State = ehttpc:get_state(EhttpcPid, minimal),
GunPid = maps:get(client, State),
true = is_pid(GunPid),
_ = exit(GunPid, kill),
ok.
kill_gun_processes(ConnectorResourceId) ->
Pool = ehttpc:workers(ConnectorResourceId),
Workers = lists:map(fun({_, Pid}) -> Pid end, Pool),
%% assert there is at least one pool member
?assertMatch([_ | _], Workers),
lists:foreach(fun(Pid) -> kill_gun_process(Pid) end, Workers).
t_unrecoverable_error(Config) -> t_unrecoverable_error(Config) ->
ActionResourceId = ?config(action_resource_id, Config), ActionResourceId = ?config(action_resource_id, Config),
ConnectorResourceId = ?config(connector_resource_id, Config),
TelemetryTable = ?config(telemetry_table, Config), TelemetryTable = ?config(telemetry_table, Config),
TestPid = self(), TestPid = self(),
FailureNoBodyHandler = FailureNoBodyHandler =
@ -1415,10 +1430,7 @@ t_unrecoverable_error(Config) ->
%% kill the gun process while it's waiting for the %% kill the gun process while it's waiting for the
%% response so we provoke an `{error, _}' response from %% response so we provoke an `{error, _}' response from
%% ehttpc. %% ehttpc.
lists:foreach( ok = kill_gun_processes(ConnectorResourceId),
fun(Pid) -> exit(Pid, kill) end,
[Pid || {_, Pid, _, _} <- supervisor:which_children(gun_sup)]
),
Rep = cowboy_req:reply( Rep = cowboy_req:reply(
200, 200,
#{<<"content-type">> => <<"application/json">>}, #{<<"content-type">> => <<"application/json">>},

View File

@ -49,7 +49,7 @@ defmodule EMQXUmbrella.MixProject do
{:redbug, github: "emqx/redbug", tag: "2.0.10"}, {:redbug, github: "emqx/redbug", tag: "2.0.10"},
{:covertool, github: "zmstone/covertool", tag: "2.0.4.1", override: true}, {:covertool, github: "zmstone/covertool", tag: "2.0.4.1", override: true},
{:typerefl, github: "ieQu1/typerefl", tag: "0.9.1", override: true}, {:typerefl, github: "ieQu1/typerefl", tag: "0.9.1", override: true},
{:ehttpc, github: "emqx/ehttpc", tag: "0.4.11", override: true}, {:ehttpc, github: "emqx/ehttpc", tag: "0.4.12", override: true},
{:gproc, github: "emqx/gproc", tag: "0.9.0.1", override: true}, {:gproc, github: "emqx/gproc", tag: "0.9.0.1", override: true},
{:jiffy, github: "emqx/jiffy", tag: "1.0.6", override: true}, {:jiffy, github: "emqx/jiffy", tag: "1.0.6", override: true},
{:cowboy, github: "emqx/cowboy", tag: "2.9.2", override: true}, {:cowboy, github: "emqx/cowboy", tag: "2.9.2", override: true},
@ -77,7 +77,7 @@ defmodule EMQXUmbrella.MixProject do
{:esasl, github: "emqx/esasl", tag: "0.2.0"}, {:esasl, github: "emqx/esasl", tag: "0.2.0"},
{:jose, github: "potatosalad/erlang-jose", tag: "1.11.2"}, {:jose, github: "potatosalad/erlang-jose", tag: "1.11.2"},
# in conflict by ehttpc and emqtt # in conflict by ehttpc and emqtt
{:gun, github: "emqx/gun", tag: "1.3.9", override: true}, {:gun, github: "emqx/gun", tag: "1.3.10", override: true},
# in conflict by emqx_connector and system_monitor # in conflict by emqx_connector and system_monitor
{:epgsql, github: "emqx/epgsql", tag: "4.7.1.1", override: true}, {:epgsql, github: "emqx/epgsql", tag: "4.7.1.1", override: true},
# in conflict by emqx and observer_cli # in conflict by emqx and observer_cli

View File

@ -64,8 +64,8 @@
, {covertool, {git, "https://github.com/zmstone/covertool", {tag, "2.0.4.1"}}} , {covertool, {git, "https://github.com/zmstone/covertool", {tag, "2.0.4.1"}}}
, {gpb, "4.19.9"} , {gpb, "4.19.9"}
, {typerefl, {git, "https://github.com/ieQu1/typerefl", {tag, "0.9.1"}}} , {typerefl, {git, "https://github.com/ieQu1/typerefl", {tag, "0.9.1"}}}
, {gun, {git, "https://github.com/emqx/gun", {tag, "1.3.9"}}} , {gun, {git, "https://github.com/emqx/gun", {tag, "1.3.10"}}}
, {ehttpc, {git, "https://github.com/emqx/ehttpc", {tag, "0.4.11"}}} , {ehttpc, {git, "https://github.com/emqx/ehttpc", {tag, "0.4.12"}}}
, {gproc, {git, "https://github.com/emqx/gproc", {tag, "0.9.0.1"}}} , {gproc, {git, "https://github.com/emqx/gproc", {tag, "0.9.0.1"}}}
, {jiffy, {git, "https://github.com/emqx/jiffy", {tag, "1.0.6"}}} , {jiffy, {git, "https://github.com/emqx/jiffy", {tag, "1.0.6"}}}
, {cowboy, {git, "https://github.com/emqx/cowboy", {tag, "2.9.2"}}} , {cowboy, {git, "https://github.com/emqx/cowboy", {tag, "2.9.2"}}}