Add back consumeAndClose functionality. (#7608)
* consume bodies for action button integrations, webrtc gateway, oauth endpoint * Fixing a couple more places, switching to io.Copy to ioutil.Discard, adding a comment to help prevent future performance regressions
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
521e27f4ac
Коммит
3461a7b207
@@ -5,6 +5,8 @@ package app
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"net/http"
|
||||
"strings"
|
||||
@@ -208,3 +210,11 @@ func (a *App) StopServer() {
|
||||
a.Srv.GracefulServer = nil
|
||||
}
|
||||
}
|
||||
|
||||
// This is required to re-use the underlying connection and not take up file descriptors
|
||||
func consumeAndClose(r *http.Response) {
|
||||
if r.Body != nil {
|
||||
io.Copy(ioutil.Discard, r.Body)
|
||||
r.Body.Close()
|
||||
}
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user