From: Amaury Denoyelle Date: Fri, 9 Oct 2026 15:14:03 +0000 (+0200) Subject: OPTIM/MINOR: proxy: remove unnecessary lookup during purge X-Git-Tag: v3.5-dev9~4 X-Git-Url: https://git.kaiwu.me/$%7BISSUES%7D/static/gitweb.js?a=commitdiff_plain;h=1aae07f01fc928f8c4c07bc156188cb20e39f2ef;p=haproxy.git OPTIM/MINOR: proxy: remove unnecessary lookup during purge Simplifies backend background deletion in purge task. Call to be_check_for_deletion() is removed, preventing an unnecessary lookup on proxies global list. Instead, only member check is necessary. Backend configuration which could block deletion were already tested via "purge backend". Also, if backend has been reset to publish state, it is no longer flagged PR_FL_TO_PURGE. --- diff --git a/src/proxy.c b/src/proxy.c index ad61f804b..c44999813 100644 --- a/src/proxy.c +++ b/src/proxy.c @@ -559,7 +559,6 @@ struct task *proxy_process_purge(struct task *t, void *context, unsigned int sta struct proxy *px = context; /* constant for max number of server delete before yield */ const int max_srv_delete = 50; - int ret = 0; /* Must not dereference before entering thread isolation and * checking task state, as proxy_drop() performed outside isolation @@ -583,12 +582,10 @@ struct task *proxy_process_purge(struct task *t, void *context, unsigned int sta } if (LIST_ISEMPTY(&px->servers_purge) && (px->flags & PR_FL_TO_PURGE)) { - /* TODO unnecessary proxy lookup */ - ret = be_check_for_deletion(px->id, PR_DEL_MODE_SYNC, NULL, NULL); - if (ret < 0) { - proxy_cancel_purge(px); - } - else if (ret > 0) { + /* If backend is published again, purge must be cancelled. */ + BUG_ON(!(px->flags & PR_FL_BE_UNPUBLISHED)); + + if (!px->beconn) { ha_notice("Backend '%s' purged.\n", px->id); be_unregister(px); proxy_drop(px);