MINOR: stream: don't wait before retrying after a failed connection reuse

When a connection reuse fails, we must not wait before retrying, as most
likely the issue is related to the reused connection and not to the server
itself.

This should be backported to 1.9, though it depends on previous patches
dealing with SI_ST_CON for connection reuse.
This commit is contained in:
Willy Tarreau 2019-01-23 16:29:53 +01:00
parent bf66bd1b8b
commit f7a259d46f

View File

@ -798,7 +798,9 @@ static int sess_update_st_cer(struct stream *s)
/* 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
* MIN(one second, connect timeout) before retrying.
* MIN(one second, connect timeout) before retrying. We don't
* do it when the failure happened on a reused connection
* though.
*/
int delay = 1000;
@ -810,9 +812,9 @@ static int sess_update_st_cer(struct stream *s)
si->err_type = SI_ET_CONN_ERR;
/* only wait when we're retrying on the same server */
if (si->state == SI_ST_ASS ||
(s->be->lbprm.algo & BE_LB_KIND) != BE_LB_KIND_RR ||
(s->be->srv_act <= 1)) {
if ((si->state == SI_ST_ASS ||
(s->be->lbprm.algo & BE_LB_KIND) != BE_LB_KIND_RR ||
(s->be->srv_act <= 1)) && !(s->flags & SF_SRV_REUSED)) {
si->state = SI_ST_TAR;
si->exp = tick_add(now_ms, MS_TO_TICKS(delay));
}