]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: server: enable slowstart for dynamic server
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 21 Sep 2021 09:51:54 +0000 (11:51 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 21 Sep 2021 12:00:32 +0000 (14:00 +0200)
Enable the 'slowstart' keyword for dynamic servers. The slowstart task
is allocated in 'add server' handler if slowstart is used.

As the server is created in disabled state, there is no need to start
the task. The slowstart task will be automatically started on the first
'enable server' invocation.

doc/management.txt
src/server.c

index 64172e5a997c657522561e3d0386bb44416e80ef..f0c28a49020e5160ba917ce34878046ebe7de013 100644 (file)
@@ -1548,6 +1548,7 @@ add server <backend>/<server> [args]*
   - send-proxy-v2
   - send-proxy-v2-ssl
   - send-proxy-v2-ssl-cn
+  - slowstart
   - sni
   - source
   - ssl
index d770bdd3b04bc2797b61ae7e612dced1dda8e438..213d10632e69875aa995937895cd75c05de89532 100644 (file)
@@ -1673,7 +1673,7 @@ static struct srv_kw_list srv_kws = { "ALL", { }, {
        { "resolvers",           srv_parse_resolvers,           1,  1,  0 }, /* Configure the resolver to use for name resolution */
        { "send-proxy",          srv_parse_send_proxy,          0,  1,  1 }, /* Enforce use of PROXY V1 protocol */
        { "send-proxy-v2",       srv_parse_send_proxy_v2,       0,  1,  1 }, /* Enforce use of PROXY V2 protocol */
-       { "slowstart",           srv_parse_slowstart,           1,  1,  0 }, /* Set the warm-up timer for a previously failed server */
+       { "slowstart",           srv_parse_slowstart,           1,  1,  1 }, /* Set the warm-up timer for a previously failed server */
        { "source",              srv_parse_source,             -1,  1,  1 }, /* Set the source address to be used to connect to the server */
        { "stick",               srv_parse_stick,               0,  1,  0 }, /* Enable stick-table persistence */
        { "tfo",                 srv_parse_tfo,                 0,  1,  1 }, /* enable TCP Fast Open of server */
@@ -4660,6 +4660,10 @@ static int cli_parse_add_server(char **args, char *payload, struct appctx *appct
                srv->agent.state &= ~CHK_ST_ENABLED;
        }
 
+       /* Init slowstart if needed. */
+       if (init_srv_slowstart(srv))
+               goto out;
+
        /* Attach the server to the end of the proxy linked list. Note that this
         * operation is not thread-safe so this is executed under thread
         * isolation.