Skip to content

Commit c35dcd7

Browse files
authored
[patch] fix: add get result retrying process (#154)
* fix: add get result retrying process * fix: move retry in err condition
1 parent 5dcef77 commit c35dcd7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

internal/staging/testrunner/gitlab/testrunner.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,14 @@ func (t *testRunner) GetResult(testConfig *s2hv1.ConfigTestRunner, currentQueue
212212
opts = append(opts, http.WithHeader("PRIVATE-TOKEN", t.privateToken))
213213
}
214214

215-
_, resp, err := http.Get(apiURL, opts...)
215+
statusCode, resp, err := http.Get(apiURL, opts...)
216+
216217
if err != nil {
218+
// Retry the process to get the result if a server error
219+
if statusCode >= 500 && statusCode < 600 {
220+
logger.Info(fmt.Sprintf("The HTTP request failed %v, retrying the process", err), "URL", apiURL)
221+
return false, false, nil
222+
}
217223
logger.Error(err, "The HTTP request failed", "URL", apiURL)
218224
return false, false, err
219225
}

0 commit comments

Comments
 (0)