Skip to content

Commit

Permalink
adding connect retries option to safeRequest (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
miki725 authored Aug 13, 2024
1 parent 3d2901d commit 38619a2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion nimutils/net.nim
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,13 @@ proc safeRequest*(client: HttpClient,
headers: HttpHeaders = nil,
multipart: MultipartData = nil,
retries: int = 0,
connectRetries: int = 0,
firstRetryDelayMs: int = 0,
only2xx: bool = false,
raiseWhenAbove: int = 0,
): Response =
timeoutGuard(client, url)
withRetry(connectRetries, firstRetryDelayMs):
timeoutGuard(client, url)
withRetry(retries, firstRetryDelayMs):
# all vars are accessed from outer scope
let response = client.request(url = url,
Expand Down Expand Up @@ -225,6 +227,7 @@ proc safeRequest*(url: Uri | string,
headers: HttpHeaders = nil,
multipart: MultipartData = nil,
retries: int = 0,
connectRetries: int = 0,
firstRetryDelayMs: int = 0,
timeout: int = 1000,
pinnedCert: string = "",
Expand All @@ -251,6 +254,7 @@ proc safeRequest*(url: Uri | string,
headers = headers,
multipart = multipart,
retries = retries,
connectRetries = connectRetries,
firstRetryDelayMs = firstRetryDelayMs,
only2xx = only2xx,
raiseWhenAbove = raiseWhenAbove)
Expand Down

0 comments on commit 38619a2

Please sign in to comment.