Skip to content

Instantly share code, notes, and snippets.

@kasvith
Created November 9, 2019 08:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kasvith/84028cdec619d7debe9eba1524e9c833 to your computer and use it in GitHub Desktop.
Save kasvith/84028cdec619d7debe9eba1524e9c833 to your computer and use it in GitHub Desktop.
// 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