What you are actually doing it moving the weak link to Server #2. If Server #1 fails sure it will satisfy that case, but what if Server #2 fails, what then? What you actually need is a cluster of servers that are load balanced with one another. Redundant Servers doing the same thing.
Basically, I call what you are doing, throwing a band aid on the real problem instead of fixing it.
Logic without the fatal effects.
All code snippets are licensed under WTFPL.
There are people out there doing similar to what you need with varnish e.g 12 There was a wp varnish plugin but it's not been updated in ages, but might prove a useful starting point. I'd always look to separate a caching proxy from your primary web server.