diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2021-04-26 02:48:12 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-25 21:48:12 +0300 |
commit | 3d5bb3e6a34bfb8073f6c61eb506cbdc927efbd4 (patch) | |
tree | d73b126596baaa256efa5d06c5ce97c9141c7dbc /services/webhook | |
parent | 6ea6e2b4eb339f58f805783532f1b481fec67375 (diff) | |
download | gitea-3d5bb3e6a34bfb8073f6c61eb506cbdc927efbd4.tar.gz gitea-3d5bb3e6a34bfb8073f6c61eb506cbdc927efbd4.zip |
fix webhook timeout bug (#15613)
* Also fix the potential problem in httplib
Diffstat (limited to 'services/webhook')
-rw-r--r-- | services/webhook/deliver.go | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/services/webhook/deliver.go b/services/webhook/deliver.go index 8ac7d8c192..a417a9e846 100644 --- a/services/webhook/deliver.go +++ b/services/webhook/deliver.go @@ -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) |