Created
November 9, 2019 08:57
-
-
Save kasvith/84028cdec619d7debe9eba1524e9c833 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
// HealthCheck pings the backends and update the status | |
func (s *ServerPool) HealthCheck() { | |
for _, b := range s.backends { | |
status := "up" | |
alive := isBackendAlive(b.URL) | |
b.SetAlive(alive) | |
if !alive { | |
status = "down" | |
} | |
log.Printf("%s [%s]\n", b.URL, status) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment