1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

fix webhook timeout bug (#15613) (#15621)

* Also fix the potential problem in httplib
This commit is contained in:
Lunny Xiao
2021-04-26 20:42:12 +08:00
committed by GitHub
parent 761111f9ed
commit cae46216e4
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)