]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mworker: only increment the number of reload in wait mode
authorWilliam Lallemand <wlallemand@haproxy.org>
Tue, 9 Nov 2021 17:43:59 +0000 (18:43 +0100)
committerWilliam Lallemand <wlallemand@haproxy.org>
Wed, 10 Nov 2021 14:53:01 +0000 (15:53 +0100)
Since the wait mode will be started in any case of succesful or failed
reload, change the way haproxy computes the number of reloads of the
processes.

src/haproxy.c
src/mworker.c

index a379cbcaea549c599458b7870ee751c908613086..a6b8dc3adf52e9e9f400e16623d01b0d476ec40d 100644 (file)
@@ -799,7 +799,15 @@ static void mworker_reexec_waitmode()
 /* reload haproxy and emit a warning */
 void mworker_reload()
 {
+       struct mworker_proc *child;
+
        ha_notice("Reloading HAProxy\n");
+
+       /* increment the number of reloads */
+       list_for_each_entry(child, &proc_list, list) {
+               child->reloads++;
+       }
+
        mworker_reexec();
 }
 
index 68aea603f9d7bc7583b2f91de80cccc2ecf3de52..fe1770618b185f77bd2ca5e5c67a6f06a92ddd62 100644 (file)
@@ -174,8 +174,8 @@ int mworker_env_to_proc_list()
                        } else if (strncmp(subtoken, "pid=", 4) == 0) {
                                child->pid = atoi(subtoken+4);
                        } else if (strncmp(subtoken, "reloads=", 8) == 0) {
-                               /* we reloaded this process once more */
-                               child->reloads = atoi(subtoken+8) + 1;
+                               /* we only increment the number of asked reload */
+                               child->reloads = atoi(subtoken+8);
                        } else if (strncmp(subtoken, "timestamp=", 10) == 0) {
                                child->timestamp = atoi(subtoken+10);
                        } else if (strncmp(subtoken, "id=", 3) == 0) {