]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: log/balance: set lbprm tot_weight on server on queue/dequeue
authorAurelien DARRAGON <adarragon@haproxy.com>
Tue, 21 Nov 2023 12:19:12 +0000 (13:19 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 24 Nov 2023 15:27:55 +0000 (16:27 +0100)
Maintain proper px->lbprm.tot_weight for log backends. server's weight is
considered as 1 as long as the server is usable.

This will allow the stats page to correctly display the proxy status since
the check currently relies on proxy's lbprm.tot_weight variable.

src/log.c

index c6222c5999c301f21cb7b6a74bd509096fbd31b0..d77f462ee04c32d7fd2406eefeb6e9f108cd980a 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -805,6 +805,8 @@ static void _log_backend_srv_queue(struct server *srv)
        }
        /* append the server to the list of available servers */
        LIST_APPEND(&p->lbprm.log.avail, &srv->lb_list);
+
+       p->lbprm.tot_weight = (p->srv_act) ? p->srv_act : p->srv_bck;
 }
 
 static void log_backend_srv_up(struct server *srv)
@@ -859,6 +861,8 @@ static void _log_backend_srv_dequeue(struct server *srv)
 
        /* reconstruct the array of usable servers */
        _log_backend_srv_recalc(p);
+
+       p->lbprm.tot_weight = (p->srv_act) ? p->srv_act : p->srv_bck;
 }
 
 static void log_backend_srv_down(struct server *srv)