]> git.kaiwu.me - haproxy.git/commit
OPTIM/MINOR: server: remove unnecessary server lookup during purge
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 9 Oct 2026 14:53:23 +0000 (16:53 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 14 Oct 2026 09:33:40 +0000 (11:33 +0200)
commit592e53fbe0d81a2e3f4eaffe5b758e60eb178886
tree708f6835aabe1e6b36860882b3de50ba0a5c73f1
parent3eec34e10f147946d202fedf146d3e9da7810353
OPTIM/MINOR: server: remove unnecessary server lookup during purge

Function srv_check_for_deletion() was previously used in proxy purge
task to determine if a server is ready to be deleted. However, this
performs an unnecessary server lookup as the server instance is already
known at this stage.

Simplify this by replacing it with new helper srv_in_use(), which
reports if a server still has active/pending/idle connections. If not
the case, removal can be performed.

This code is safe as it runs in thread isolation. If a server is removed
via another path before proxy purge task, it will be removed from
backend purge list. Furthermore, it also eliminates unnecessary checks
on server configuration : only a removable server can be inserted in the
proxy purge list.
include/haproxy/server.h
src/proxy.c
src/server.c