Skip to content

Commit

Permalink
fix: Fixing context canceled issue when fetching package
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Boutour <[email protected]>
  • Loading branch information
ViBiOh committed Nov 13, 2021
1 parent e07bd76 commit 8a52123
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 37 deletions.
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ module github.com/ViBiOh/ketchup
go 1.17

require (
github.com/ViBiOh/auth/v2 v2.11.16
github.com/ViBiOh/httputils/v4 v4.27.1
github.com/ViBiOh/mailer v1.26.5
github.com/ViBiOh/auth/v2 v2.11.18
github.com/ViBiOh/httputils/v4 v4.28.4
github.com/ViBiOh/mailer v1.26.7
github.com/golang/mock v1.6.0
github.com/jackc/pgconn v1.10.0
github.com/jackc/pgproto3/v2 v2.1.1
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
github.com/ViBiOh/auth/v2 v2.11.16 h1:WQMFJQ0MV0wfWrl5Vzp6n9x/+6xKIDZIEL/5NAkYUMo=
github.com/ViBiOh/auth/v2 v2.11.16/go.mod h1:yJYxlSM+kExx/6lFt8tvWLVa0UEL8itqoN4H8XW0DZo=
github.com/ViBiOh/httputils/v4 v4.27.1 h1:A1fcp/Brv7y0OzF2xDid9vdPGSOo9tLqVjb3GG7Q66U=
github.com/ViBiOh/httputils/v4 v4.27.1/go.mod h1:r4OWjqIH9F9UG0irKIeNSHMWtdk/AzlXpnMHtpKQ7yo=
github.com/ViBiOh/mailer v1.26.5 h1:mFTa8K7QVdk29t2gN196fNv/TKua1QsLUy2iTrQkGAs=
github.com/ViBiOh/mailer v1.26.5/go.mod h1:183ohYDmy8cVcTv9Tngbpu3saLjly80HzxWv6v3sr7k=
github.com/ViBiOh/auth/v2 v2.11.18 h1:hw4GBwc6OwXqsPApk4KvFCcK0trBn9bMQDD6Aw++kVw=
github.com/ViBiOh/auth/v2 v2.11.18/go.mod h1:S/sTxlp3SKuKTB2z8UQSafohcGFkOm+hViYMx08RJDc=
github.com/ViBiOh/httputils/v4 v4.28.4 h1:8J2+XUXouiWUM3puevn+1omkb6FTUe2Mm3uP91Wj3hE=
github.com/ViBiOh/httputils/v4 v4.28.4/go.mod h1:r4OWjqIH9F9UG0irKIeNSHMWtdk/AzlXpnMHtpKQ7yo=
github.com/ViBiOh/mailer v1.26.7 h1:ycXOq78drvh2FD4scJAlY+L9yinKqhBaX/+qnHpCRqk=
github.com/ViBiOh/mailer v1.26.7/go.mod h1:HR+WViBCvOjtn7R2WqLjOabVwYOO/m3kXmMhjeRTjDM=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
Expand Down
32 changes: 4 additions & 28 deletions pkg/provider/github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"flag"
"fmt"
"net"
"net/http"
"strings"
"time"
Expand All @@ -22,33 +21,10 @@ import (
var (
apiURL = "https://api.github.com"

httpClient = &http.Client{
Transport: &http.Transport{
Proxy: http.ProxyFromEnvironment,
ForceAttemptHTTP2: true,

DialContext: (&net.Dialer{
Timeout: 5 * time.Second,
KeepAlive: 15 * time.Second,
}).DialContext,

TLSHandshakeTimeout: 5 * time.Second,
ExpectContinueTimeout: 1 * time.Second,
ResponseHeaderTimeout: 5 * time.Second,

MaxConnsPerHost: 100,
MaxIdleConns: 100,
MaxIdleConnsPerHost: 100,
IdleConnTimeout: 60 * time.Second,
},

Timeout: 30 * time.Second,

CheckRedirect: func(r *http.Request, via []*http.Request) error {
logger.Info("Redirect from %s to %s", via[len(via)-1].URL.Path, r.URL.Path)
return nil
},
}
httpClient = request.CreateClient(30*time.Second, func(r *http.Request, via []*http.Request) error {
logger.Info("Redirect from %s to %s", via[len(via)-1].URL.Path, r.URL.Path)
return nil
})
)

type redis interface {
Expand Down

0 comments on commit 8a52123

Please sign in to comment.