Skip to content

Commit

Permalink
[patch] fix: add get result retrying process (#154)
Browse files Browse the repository at this point in the history
* fix: add get result retrying process

* fix: move retry in err condition
  • Loading branch information
mmengspv authored Sep 12, 2023
1 parent 5dcef77 commit c35dcd7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion internal/staging/testrunner/gitlab/testrunner.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,14 @@ func (t *testRunner) GetResult(testConfig *s2hv1.ConfigTestRunner, currentQueue
opts = append(opts, http.WithHeader("PRIVATE-TOKEN", t.privateToken))
}

_, resp, err := http.Get(apiURL, opts...)
statusCode, resp, err := http.Get(apiURL, opts...)

if err != nil {
// Retry the process to get the result if a server error
if statusCode >= 500 && statusCode < 600 {
logger.Info(fmt.Sprintf("The HTTP request failed %v, retrying the process", err), "URL", apiURL)
return false, false, nil
}
logger.Error(err, "The HTTP request failed", "URL", apiURL)
return false, false, err
}
Expand Down

0 comments on commit c35dcd7

Please sign in to comment.