Skip to content

Commit

Permalink
Do not reply with status 503 if services are unavailable
Browse files Browse the repository at this point in the history
  • Loading branch information
anbsky committed Apr 27, 2020
1 parent e7e03ac commit fa64cae
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 0 additions & 2 deletions internal/status/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,10 @@ func GetStatus(w http.ResponseWriter, req *http.Request) {
if err != nil {
srv.Error = fmt.Sprintf("%v", err)
srv.Status = statusOffline
respStatus = http.StatusServiceUnavailable
failureDetected = true
} else if r.StatusCode != http.StatusNotFound {
srv.Status = statusNotReady
srv.Error = fmt.Sprintf("http status %v", r.StatusCode)
respStatus = http.StatusServiceUnavailable
failureDetected = true
}
services["player"] = append(services["player"], srv)
Expand Down
6 changes: 4 additions & 2 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ func NewServer(address string, sdkRouter *sdkrouter.Router) *Server {
stopWait: 15 * time.Second,
stopChan: make(chan os.Signal),
listener: &http.Server{
Addr: address,
Handler: r,
Addr: address,
Handler: r,
// We need this for long uploads
WriteTimeout: 0,
IdleTimeout: 0,
ReadHeaderTimeout: 10 * time.Second,
},
Expand Down

0 comments on commit fa64cae

Please sign in to comment.