Skip to content

Commit 52ab32e

Browse files
Make it possible to configure randomized startup delay range via new style config
1 parent f34890e commit 52ab32e

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

priv/schema/rabbit.schema

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -833,6 +833,32 @@ fun(Conf) ->
833833
end
834834
end}.
835835

836+
%% Cluster formation: Randomized startup delay
837+
838+
{mapping, "cluster_formation.randomized_startup_delay_range.min", "rabbit.cluster_formation.randomized_delay_range",
839+
[{datatype, integer}]}.
840+
{mapping, "cluster_formation.randomized_startup_delay_range.max", "rabbit.cluster_formation.randomized_delay_range",
841+
[{datatype, integer}]}.
842+
843+
{translation, "rabbit.cluster_formation.randomized_delay_range",
844+
fun(Conf) ->
845+
Min = cuttlefish:conf_get("cluster_formation.randomized_startup_delay_range.min", Conf, undefined),
846+
Max = cuttlefish:conf_get("cluster_formation.randomized_startup_delay_range.max", Conf, undefined),
847+
848+
case {Min, Max} of
849+
{undefined, undefined} ->
850+
cuttlefish:unset();
851+
{undefined, Max} ->
852+
%% fallback default
853+
{5, Max};
854+
{Min, undefined} ->
855+
%% fallback default
856+
{Min, 60};
857+
{Min, Max} ->
858+
{Min, Max}
859+
end
860+
end}.
861+
836862
%% Classic config-driven peer discuvery backend.
837863
%%
838864
%% Make clustering happen *automatically* at startup - only applied

test/config_schema_SUITE_data/rabbit.snippets

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,29 @@ tcp_listen_options.exit_on_close = false",
372372
"tcp_listen_options.linger.timeout = 100",
373373
[{rabbit,[{tcp_listen_options,[{linger,{false,100}}]}]}],
374374
[]},
375+
376+
{cluster_formation_randomized_startup_delay_both_values,
377+
"cluster_formation.randomized_startup_delay_range.min = 10
378+
cluster_formation.randomized_startup_delay_range.max = 30",
379+
[{rabbit, [{cluster_formation, [
380+
{randomized_delay_range, {10, 30}}
381+
]}]}],
382+
[]},
383+
384+
{cluster_formation_randomized_startup_delay_min_only,
385+
"cluster_formation.randomized_startup_delay_range.min = 10",
386+
[{rabbit, [{cluster_formation, [
387+
{randomized_delay_range, {10, 60}}
388+
]}]}],
389+
[]},
390+
391+
{cluster_formation_randomized_startup_delay_max_only,
392+
"cluster_formation.randomized_startup_delay_range.max = 30",
393+
[{rabbit, [{cluster_formation, [
394+
{randomized_delay_range, {5, 30}}
395+
]}]}],
396+
[]},
397+
375398
{cluster_formation_dns,
376399
"cluster_formation.peer_discovery_backend = rabbit_peer_discovery_dns
377400
cluster_formation.dns.hostname = 192.168.0.2.xip.io

0 commit comments

Comments
 (0)