Commit 21eb5204 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

On fetch failure, make the vcl_backend_error{} object cacheable

for 5 seconds if there is a waiting list.

This allows the waiting list to drain (returning 503) quickly,
rather than one by one trying to pester the backend and only
giving up after the connect_timeout.

Related to: #1823
parent 70de08d2
......@@ -795,8 +795,22 @@ vbf_stp_error(struct worker *wrk, struct busyobj *bo)
http_TimeHeader(bo->beresp, "Date: ", now);
http_SetHeader(bo->beresp, "Server: Varnish");
EXP_Clr(&bo->fetch_objcore->exp);
bo->fetch_objcore->exp.t_origin = bo->t_prev;
if (bo->fetch_objcore->objhead->waitinglist != NULL) {
/*
* If there is a waitinglist, it means that there is no
* grace-able object, so cache the error return for a
* short time, so the waiting list can drain, rather than
* each objcore on the waiting list sequentially attempt
* to fetch from the backend.
*/
bo->fetch_objcore->exp.t_origin = now;
bo->fetch_objcore->exp.ttl = 1;
bo->fetch_objcore->exp.grace = 5;
bo->fetch_objcore->exp.keep = 5;
} else {
EXP_Clr(&bo->fetch_objcore->exp);
bo->fetch_objcore->exp.t_origin = now;
}
synth_body = VSB_new_auto();
AN(synth_body);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment