(retries uint, req *http.Request, onError func(err errors.Error) bool)
| 256 | } |
| 257 | |
| 258 | func (d *DevlakeClient) forceSendHttpRequest(retries uint, req *http.Request, onError func(err errors.Error) bool) { |
| 259 | d.testCtx.Helper() |
| 260 | for { |
| 261 | res, err := http.DefaultClient.Do(req) |
| 262 | if err != nil { |
| 263 | if !onError(errors.Default.WrapRaw(err)) { |
| 264 | require.NoError(d.testCtx, err) |
| 265 | } |
| 266 | } else { |
| 267 | if res.StatusCode != http.StatusOK { |
| 268 | panic(fmt.Sprintf("received HTTP status %d", res.StatusCode)) |
| 269 | } |
| 270 | return |
| 271 | } |
| 272 | retries-- |
| 273 | if retries == 0 { |
| 274 | panic("retry limit exceeded") |
| 275 | } |
| 276 | fmt.Printf("retrying http call to %s\n", req.URL.String()) |
| 277 | time.Sleep(1 * time.Second) |
| 278 | } |
| 279 | } |
| 280 | |
| 281 | func (d *DevlakeClient) initPlugins(cfg *LocalClientConfig) { |
| 282 | d.testCtx.Helper() |
no test coverage detected