fix(bridge): make dryrun health check timeout more malleable

Fixes https://emqx.atlassian.net/browse/EMQX-10773

- Makes the timeout for probing a bridge more malleable to account for differences between
  each database.
- Increases GCP PubSub Consumer default health check timeout to account for GCP
  slowness/throttling.
This commit is contained in:
Thales Macedo Garitezi 2023-08-16 13:42:01 -03:00
parent c60751b401
commit ebecbd1545
6 changed files with 11 additions and 4 deletions

View File

@ -1,6 +1,6 @@
{application, emqx_bridge_gcp_pubsub, [
{description, "EMQX Enterprise GCP Pub/Sub Bridge"},
{vsn, "0.1.6"},
{vsn, "0.1.7"},
{registered, []},
{applications, [
kernel,

View File

@ -191,7 +191,10 @@ fields(consumer_topic_mapping) ->
)}
];
fields("consumer_resource_opts") ->
ResourceFields = emqx_resource_schema:fields("creation_opts"),
ResourceFields =
emqx_resource_schema:create_opts(
[{health_check_interval, #{default => <<"30s">>}}]
),
SupportedFields = [
auto_restart_interval,
health_check_interval,

View File

@ -1,7 +1,7 @@
%% -*- mode: erlang -*-
{application, emqx_resource, [
{description, "Manager for all external resources"},
{vsn, "0.1.21"},
{vsn, "0.1.22"},
{registered, []},
{mod, {emqx_resource_app, []}},
{applications, [

View File

@ -179,7 +179,9 @@ create_dry_run(ResourceType, Config) ->
false -> #{}
end,
ok = emqx_resource_manager_sup:ensure_child(ResId, <<"dry_run">>, ResourceType, Config, Opts),
case wait_for_ready(ResId, 5000) of
HealthCheckInterval = maps:get(health_check_interval, Opts, ?HEALTHCHECK_INTERVAL),
Timeout = emqx_utils:clamp(HealthCheckInterval, 5_000, 60_000),
case wait_for_ready(ResId, Timeout) of
ok ->
remove(ResId);
{error, Reason} ->

View File

@ -47,6 +47,7 @@ fields("resource_opts") ->
fields("creation_opts") ->
create_opts([]).
-spec create_opts([{atom(), hocon_schema:field_schema_map()}]) -> [{atom(), hocon_schema:field()}].
create_opts(Overrides) ->
override(
[

View File

@ -0,0 +1 @@
Made the timeout for testing bridges connectivity follow more closely the configured health check timeout.