fix: server in shutdown should return 503 instead of 403 (#13496)

various situations where the client is retrying the request
server going through shutdown might incorrectly send 403
which is a non-retriable error, this PR allows for clients
when they retry an attempt to go to another healthy pod
or server in a distributed cluster - assuming it is a properly
load-balanced setup.
This commit is contained in:
Harshavardhana 2021-10-22 01:30:27 -07:00 committed by GitHub
parent e7f559c582
commit 087dc13965
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -90,7 +90,7 @@ func (srv *Server) Start(ctx context.Context) (err error) {
if atomic.LoadUint32(&srv.inShutdown) != 0 {
// To indicate disable keep-alives
w.Header().Set("Connection", "close")
w.WriteHeader(http.StatusForbidden)
w.WriteHeader(http.StatusServiceUnavailable)
w.Write([]byte(http.ErrServerClosed.Error()))
w.(http.Flusher).Flush()
return