Created
November 9, 2019 08:29
-
-
Save kasvith/1dd7e2b84b10552aa48f910985986454 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// lb load balances the incoming request | |
func lb(w http.ResponseWriter, r *http.Request) { | |
peer := serverPool.GetNextPeer() | |
if peer != nil { | |
peer.ReverseProxy.ServeHTTP(w, r) | |
return | |
} | |
http.Error(w, "Service not available", http.StatusServiceUnavailable) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment