Skip to content

Commit c029a08

Browse files
authored
fix(api): update http client between services (#5779)
Signed-off-by: Yvonnick Esnault <yvonnick.esnault@corp.ovh.com>
1 parent 186889b commit c029a08

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

engine/api/services/http.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,7 @@ func doRequest(ctx context.Context, srv *sdk.Service, method, path string, args
253253

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

261259
if HTTPSigner == nil {

engine/worker/internal/handler_download.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,15 +185,15 @@ func GetArtifactFromAPI(ctx context.Context, wk *CurrentWorker, projectKey strin
185185
return newError
186186
}
187187

188-
regexp, errp := regexp.Compile(reqArgs.Pattern)
189-
if errp != nil {
190-
newError := sdk.NewError(sdk.ErrWrongRequest, fmt.Errorf("Invalid pattern %s : %s", reqArgs.Pattern, errp))
188+
regexp, err := regexp.Compile(reqArgs.Pattern)
189+
if err != nil {
190+
newError := sdk.NewError(sdk.ErrWrongRequest, fmt.Errorf("invalid pattern %s : %v", reqArgs.Pattern, err))
191191
return newError
192192
}
193193
wg := new(sync.WaitGroup)
194194
wg.Add(len(artifacts))
195195

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

198198
var isInError bool
199199
for i := range artifacts {

0 commit comments

Comments
 (0)