From: Willy Tarreau Date: Mon, 25 Jul 2011 06:37:44 +0000 (+0200) Subject: [MINOR] sessions: only wake waiting listeners up if rate limit is OK X-Git-Tag: v1.5-dev8~169 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b32907b6c72a638f803459670817e8d3f20077ac;p=thirdparty%2Fhaproxy.git [MINOR] sessions: only wake waiting listeners up if rate limit is OK Instead of waking a listener up then making it sleep, we only wake them up if we know their rate limit is fine. In the future we could improve on top of that by deciding to wake a proxy-specific task in XX milliseconds to take care of enabling the listeners again. --- diff --git a/src/session.c b/src/session.c index 65c92db0d1..8b50aa9221 100644 --- a/src/session.c +++ b/src/session.c @@ -2096,7 +2096,8 @@ struct task *process_session(struct task *t) if (!LIST_ISEMPTY(&global_listener_queue)) dequeue_all_listeners(&global_listener_queue); - if (!LIST_ISEMPTY(&s->fe->listener_queue)) + if (!LIST_ISEMPTY(&s->fe->listener_queue) && + (!s->fe->fe_sps_lim || freq_ctr_remain(&s->fe->fe_sess_per_sec, s->fe->fe_sps_lim, 0) > 0)) dequeue_all_listeners(&s->fe->listener_queue); if (unlikely((global.mode & MODE_DEBUG) &&