Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(api): update http client between services #5779

Merged
merged 1 commit into from
Mar 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions engine/api/services/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,7 @@ func doRequest(ctx context.Context, srv *sdk.Service, method, path string, args

func doRequestFromURL(ctx context.Context, method string, callURL *url.URL, reader io.Reader, mods ...cdsclient.RequestModifier) ([]byte, http.Header, int, error) {
if HTTPClient == nil {
HTTPClient = &http.Client{
Timeout: 60 * time.Second,
}
HTTPClient = cdsclient.NewHTTPClient(60*time.Second, false)
}

if HTTPSigner == nil {
Expand Down
8 changes: 4 additions & 4 deletions engine/worker/internal/handler_download.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,15 +185,15 @@ func GetArtifactFromAPI(ctx context.Context, wk *CurrentWorker, projectKey strin
return newError
}

regexp, errp := regexp.Compile(reqArgs.Pattern)
if errp != nil {
newError := sdk.NewError(sdk.ErrWrongRequest, fmt.Errorf("Invalid pattern %s : %s", reqArgs.Pattern, errp))
regexp, err := regexp.Compile(reqArgs.Pattern)
if err != nil {
newError := sdk.NewError(sdk.ErrWrongRequest, fmt.Errorf("invalid pattern %s : %v", reqArgs.Pattern, err))
return newError
}
wg := new(sync.WaitGroup)
wg.Add(len(artifacts))

wk.SendLog(ctx, workerruntime.LevelInfo, "Downloading artifacts from into current directory")
wk.SendLog(ctx, workerruntime.LevelInfo, "Downloading artifacts into current directory")

var isInError bool
for i := range artifacts {
Expand Down