MCPcopy Create free account
hub / github.com/devnullvoid/pvetui / shouldRetry

Method shouldRetry

pkg/api/http.go:214–227  ·  view source on GitHub ↗

shouldRetry determines if a request should be retried.

(err error, attempt, maxRetries int)

Source from the content-addressed store, hash-verified

212
213// shouldRetry determines if a request should be retried.
214func (hc *HTTPClient) shouldRetry(err error, attempt, maxRetries int) bool {
215 if attempt >= maxRetries {
216 return false
217 }
218
219 // Retry on network errors, timeouts, and 5xx server errors
220 if strings.Contains(err.Error(), "connection") ||
221 strings.Contains(err.Error(), "timeout") ||
222 strings.Contains(err.Error(), "status 5") {
223 return true
224 }
225
226 return false
227}

Callers 3

doRequestWithRetryMethod · 0.95

Calls 1

ErrorMethod · 0.65

Tested by 2