From dfbf4a6fadc55b1d8bc2ac8231ffb45eeef11519 Mon Sep 17 00:00:00 2001 From: Jimmy Zelinskie Date: Sun, 8 Feb 2015 17:15:27 -0500 Subject: [PATCH] http: ping backend on healthcheck Fixes #37. --- http/routes.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/http/routes.go b/http/routes.go index a7eae79..f2733d1 100644 --- a/http/routes.go +++ b/http/routes.go @@ -33,6 +33,10 @@ func handleError(err error) (int, error) { } func (s *Server) check(w http.ResponseWriter, r *http.Request, p httprouter.Params) (int, error) { + // Ping the backend if private tracker is enabled. + if err := s.tracker.Backend.Ping(); s.config.PrivateEnabled && err != nil { + return handleError(err) + } _, err := w.Write([]byte("STILL-ALIVE")) return handleError(err) }