Hi Mattias, Have you tried something with a restart ? You could decide for instance to change the backend to maintenance and restart if you're in vcl_error and backend is not healthy.
Cheers, Dridi On Wed, Jul 30, 2014 at 9:38 AM, Mattias Geniar <[email protected]> wrote: > >>> I¹d like to get fancy with grace stored objects, but I¹m not sure how >>>to do this. Can I determine if there¹s a grace object I could deliver? >>>Basically I want my logic to be: > > As a follow-up to this thread, I'm wondering if the following is possible, > given that there is a director present with 2 servers, having health > probes configured. > > If the director has no healthy backends; > 1. See if a grace object is available, if so, deliver it > 2. If no grace object is available, change the backend to a "maintenance" > one to serve a static HTML page for maintenance purposes > > The struggle is in vcl_recv {}, how would this be able to work? If I use > req.backend.healthy to determine the backend health to set a new backend, > I lose the grace ability (as it'll be passed to the new, available, > backend?). Or I'm missing something here. > > # Use grace, when available and when needed > if (! req.backend.healthy) { > # Backends are sick, so fall back to a stale object, if possible > set req.grace = 5m; > > # If no stale object is available, how should we switch to a new backend > here? > set req.backend = maintenance_backend; # This could serve static pages > with maintenance info > } > > > I'm thing something like this, but it's not possible? > if (req.grace.available) { > set req.grace = 5m; > } else { > # No grace object available, set new backend > set req.backend = maintenance_backend; > } > > Thanks, > > Mattias > > > _______________________________________________ > varnish-misc mailing list > [email protected] > https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc _______________________________________________ varnish-misc mailing list [email protected] https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
