1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-03 09:07:19 +00:00

fix webhook timeout bug (#15613)

* Also fix the potential problem in httplib
This commit is contained in:
Lunny Xiao
2021-04-26 02:48:12 +08:00
committed by GitHub
parent 6ea6e2b4eb
commit 3d5bb3e6a3
2 changed files with 7 additions and 10 deletions

View File

@ -271,14 +271,10 @@ func InitDeliverHooks() {
TLSClientConfig: &tls.Config{InsecureSkipVerify: setting.Webhook.SkipTLSVerify},
Proxy: webhookProxy(),
Dial: func(netw, addr string) (net.Conn, error) {
conn, err := net.DialTimeout(netw, addr, timeout)
if err != nil {
return nil, err
}
return conn, conn.SetDeadline(time.Now().Add(timeout))
return net.DialTimeout(netw, addr, timeout) // dial timeout
},
},
Timeout: timeout, // request timeout
}
go graceful.GetManager().RunWithShutdownContext(DeliverHooks)