fix: for frozen calls return if client disconnects (#15062)

This commit is contained in:
Harshavardhana 2022-06-09 05:06:47 -07:00 committed by GitHub
parent 5fb420c703
commit 214ea14f29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -247,7 +247,12 @@ func maxClients(f http.HandlerFunc) http.HandlerFunc {
if val := globalServiceFreeze.Load(); val != nil {
if unlock, ok := val.(chan struct{}); ok && unlock != nil {
// Wait until unfrozen.
<-unlock
select {
case <-unlock:
case <-r.Context().Done():
// if client canceled we don't need to wait here forever.
return
}
}
}
}