diff --git a/src/backend.c b/src/backend.c index 44cda1a28..35e6f781d 100644 --- a/src/backend.c +++ b/src/backend.c @@ -548,6 +548,13 @@ static struct server *get_server_rnd(struct stream *s, const struct server *avoi curr = prev; } while (--draws > 0); + /* if the selected server is full, pretend we have none so that we reach + * the backend's queue instead. + */ + if (curr && + (curr->nbpend || (curr->maxconn && curr->served >= srv_dynamic_maxconn(curr)))) + curr = NULL; + return curr; }