mirror of
https://github.com/pgsty/minio.git
synced 2026-07-19 04:00:25 +03:00
introduce reader deadlines for net.Conn (#19023)
Bonus: set "retry-after" header for AWS SDKs if possible to honor them.
This commit is contained in:
@@ -109,8 +109,12 @@ func (srv *Server) Init(listenCtx context.Context, listenErrCallback func(listen
|
||||
wrappedHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
// If server is in shutdown.
|
||||
if atomic.LoadUint32(&srv.inShutdown) != 0 {
|
||||
// To indicate disable keep-alive
|
||||
// To indicate disable keep-alive, server is shutting down.
|
||||
w.Header().Set("Connection", "close")
|
||||
|
||||
// Add 1 minute retry header, incase-client wants to honor it
|
||||
w.Header().Set(RetryAfter, "60")
|
||||
|
||||
w.WriteHeader(http.StatusServiceUnavailable)
|
||||
w.Write([]byte(http.ErrServerClosed.Error()))
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user