Merge pull request #11163 from thalesmg/fix-rm-mongo-topology-pool-size

fix(mongodb): hide `topology.pool_size` and fix it at 1
This commit is contained in:
Thales Macedo Garitezi 2023-06-30 13:13:02 -03:00 committed by GitHub
commit 7cf1dd7e86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 2 deletions

View File

@ -97,7 +97,14 @@ fields(sharded) ->
] ++ mongo_fields(); ] ++ mongo_fields();
fields(topology) -> fields(topology) ->
[ [
{pool_size, fun emqx_connector_schema_lib:pool_size/1}, {pool_size,
hoconsc:mk(
pos_integer(),
#{
deprecated => {since, "5.1.1"},
importance => ?IMPORTANCE_HIDDEN
}
)},
{max_overflow, fun max_overflow/1}, {max_overflow, fun max_overflow/1},
{overflow_ttl, duration("overflow_ttl")}, {overflow_ttl, duration("overflow_ttl")},
{overflow_check_period, duration("overflow_check_period")}, {overflow_check_period, duration("overflow_check_period")},
@ -174,7 +181,23 @@ on_start(
false -> false ->
[{ssl, false}] [{ssl, false}]
end, end,
Topology = maps:get(topology, NConfig, #{}), Topology0 = maps:get(topology, NConfig, #{}),
%% we fix this at 1 because we already have ecpool
case maps:get(pool_size, Topology0, 1) =:= 1 of
true ->
ok;
false ->
?SLOG(
info,
#{
msg => "mongodb_overriding_topology_pool_size",
connector => InstId,
reason => "this option is deprecated; please set `pool_size' for the connector",
value => 1
}
)
end,
Topology = Topology0#{pool_size => 1},
Opts = [ Opts = [
{mongo_type, init_type(NConfig)}, {mongo_type, init_type(NConfig)},
{hosts, Hosts}, {hosts, Hosts},

View File

@ -0,0 +1 @@
Fixed `topology.pool_size = 1` and hid such option from users for MondoDB bridges to avoid confusion.