mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-16 16:34:42 +00:00
MEDIUM: session: allow shorter retry delay if timeout connect is small
As discussed with Dmitry Sivachenko, the default 1-second connect retry delay can be large for situations where the connect timeout is much smaller, because it means that an active connection reject will take more time to be retried than a silent drop, and that does not make sense. This patch changes this so that the retry delay is the minimum of 1 second and the connect timeout. That way people running with sub-second connect timeout will benefit from the shorter reconnect.
This commit is contained in:
parent
18bf01e900
commit
b02906659b
@ -899,14 +899,19 @@ static int sess_update_st_cer(struct session *s, struct stream_interface *si)
|
||||
/* The error was an asynchronous connection error, and we will
|
||||
* likely have to retry connecting to the same server, most
|
||||
* likely leading to the same result. To avoid this, we wait
|
||||
* one second before retrying.
|
||||
* MIN(one second, connect timeout) before retrying.
|
||||
*/
|
||||
|
||||
int delay = 1000;
|
||||
|
||||
if (s->be->timeout.connect && s->be->timeout.connect < delay)
|
||||
delay = s->be->timeout.connect;
|
||||
|
||||
if (!si->err_type)
|
||||
si->err_type = SI_ET_CONN_ERR;
|
||||
|
||||
si->state = SI_ST_TAR;
|
||||
si->exp = tick_add(now_ms, MS_TO_TICKS(1000));
|
||||
si->exp = tick_add(now_ms, MS_TO_TICKS(delay));
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user