BBlack has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/259979

Change subject: VCL: move retry5xx to parsoid (only user left)
......................................................................

VCL: move retry5xx to parsoid (only user left)

Change-Id: I67315652be4f00ea63396fbc62f38e00e8e1a1cf
---
M modules/role/manifests/cache/parsoid.pp
M modules/varnish/templates/vcl/wikimedia.vcl.erb
M templates/varnish/parsoid-backend.inc.vcl.erb
3 files changed, 17 insertions(+), 16 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/79/259979/1

diff --git a/modules/role/manifests/cache/parsoid.pp 
b/modules/role/manifests/cache/parsoid.pp
index e6df59e..65e8ea0 100644
--- a/modules/role/manifests/cache/parsoid.pp
+++ b/modules/role/manifests/cache/parsoid.pp
@@ -26,12 +26,10 @@
     $be_vcl_config = merge($common_vcl_config, {
         'layer'            => 'backend',
         'retry503'         => 4,
-        'retry5xx'         => 1,
     })
 
     $fe_vcl_config = merge($common_vcl_config, {
         'layer'            => 'frontend',
-        'retry5xx'         => 0,
     })
 
     varnish::instance { 'parsoid-backend':
diff --git a/modules/varnish/templates/vcl/wikimedia.vcl.erb 
b/modules/varnish/templates/vcl/wikimedia.vcl.erb
index 1e116df..d3258f4 100644
--- a/modules/varnish/templates/vcl/wikimedia.vcl.erb
+++ b/modules/varnish/templates/vcl/wikimedia.vcl.erb
@@ -504,20 +504,7 @@
        elsif (beresp.status >= 400 && beresp.status <= 499 && beresp.ttl > <%= 
@vcl_config.fetch("cache4xx", "5m") %>) {
                set beresp.ttl = <%= @vcl_config.fetch("cache4xx", "5m") %>;
        }
-<% if @vcl_config.fetch("retry5xx", "0") == "1" -%>
-       if (beresp.status >= 500 && beresp.status < 505) {
-               # Retry the backend request 3 times, then give up and display
-               # the backend's error page, instead of our own.
-               #
-               # Note that max_restarts is 4 by default, so Varnish would
-               # otherwise detect this as a loop and present its own 503.
-               if (req.restarts < 3) {
-                       return(restart);
-               } else {
-                       return(deliver);
-               }
-       }
-<% end -%>
+
        set beresp.grace = 60m;
 
 <% if @vcl_config.fetch("do_gzip", false) -%>
diff --git a/templates/varnish/parsoid-backend.inc.vcl.erb 
b/templates/varnish/parsoid-backend.inc.vcl.erb
index bf17d454..f8b0124 100644
--- a/templates/varnish/parsoid-backend.inc.vcl.erb
+++ b/templates/varnish/parsoid-backend.inc.vcl.erb
@@ -14,3 +14,19 @@
                error 412 "Entity not in cache";
        }
 }
+
+sub vcl_fetch {
+       // This is our legacy retry5xx code, only parsoid backend still uses it
+       if (beresp.status >= 500 && beresp.status < 505) {
+               # Retry the backend request 3 times, then give up and display
+               # the backend's error page, instead of our own.
+               #
+               # Note that max_restarts is 4 by default, so Varnish would
+               # otherwise detect this as a loop and present its own 503.
+               if (req.restarts < 3) {
+                       return(restart);
+               } else {
+                       return(deliver);
+               }
+       }
+}

-- 
To view, visit https://gerrit.wikimedia.org/r/259979
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I67315652be4f00ea63396fbc62f38e00e8e1a1cf
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: BBlack <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to