mirror of
https://github.com/sot-tech/mochi.git
synced 2026-05-11 14:41:16 -07:00
http: improve clarity of /check
This commit is contained in:
@@ -33,10 +33,13 @@ func handleError(err error) (int, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) check(w http.ResponseWriter, r *http.Request, p httprouter.Params) (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.
|
// Attempt to ping the backend if private tracker is enabled.
|
||||||
if err := s.tracker.Backend.Ping(); s.config.PrivateEnabled && err != nil {
|
if s.config.PrivateEnabled {
|
||||||
return handleError(err)
|
if err := s.tracker.Backend.Ping(); err != nil {
|
||||||
|
return handleError(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err := w.Write([]byte("STILL-ALIVE"))
|
_, err := w.Write([]byte("STILL-ALIVE"))
|
||||||
return handleError(err)
|
return handleError(err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user