Commit 33d80aba authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Implement "return(retry)" in vcl_backend_error{}

parent 2eabf10f
......@@ -666,7 +666,20 @@ vbf_stp_error(struct worker *wrk, struct busyobj *bo)
AZ(VSB_finish(bo->synth_body));
xxxassert(wrk->handling == VCL_RET_DELIVER);
if (wrk->handling == VCL_RET_RETRY) {
VSB_delete(bo->synth_body);
bo->synth_body = NULL;
if (bo->retries++ < cache_param->max_retries) {
return (F_STP_RETRY);
}
bo->synth_body = NULL;
HSH_Fail(bo->fetch_objcore);
VBO_setstate(bo, BOS_FAILED);
HSH_Complete(bo->fetch_objcore);
return (F_STP_DONE);
}
assert(wrk->handling == VCL_RET_DELIVER);
if (vbf_beresp2obj(bo)) {
VBO_setstate(bo, BOS_FAILED);
......
varnishtest "retry in vcl_backend_error"
varnish v1 -vcl {
backend b1 { .host = "${bad_ip}"; }
sub vcl_backend_error {
return (retry);
}
sub vcl_error {
set obj.status = 504;
}
} -start
varnish v1 -cliok "param.set debug +syncvsl"
varnish v1 -cliok "param.set connect_timeout 1"
varnish v1 -cliok "param.set max_retries 2"
client c1 {
txreq
rxresp
expect resp.status == 504
} -run
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