Skip to content

Commit

Permalink
fix(api): update http client between services (#5779)
Browse files Browse the repository at this point in the history
Signed-off-by: Yvonnick Esnault <[email protected]>
  • Loading branch information
yesnault authored Mar 29, 2021
1 parent 186889b commit c029a08
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
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

0 comments on commit c029a08

Please sign in to comment.