Skip to content

Commit

Permalink
breaking out of retry loop on success
Browse files Browse the repository at this point in the history
  • Loading branch information
miki725 committed Aug 13, 2024
1 parent 7e435fa commit c3b44fa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion nimutils/net.nim
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ template withRetry(retries: int, firstRetryDelayMs: int, c: untyped) =
while attempts <= retries:
try:
c
break
except:
if attempts == retries:
# reraise last exception to bubble error up
Expand All @@ -139,7 +140,6 @@ template withRetry(retries: int, firstRetryDelayMs: int, c: untyped) =
if delayMs > 0:
sleep(delayMs)
attempts += 1
raise newException(ValueError, "retried code block didnt return. this should never happen")

proc check*(response: Response,
url: Uri | string,
Expand Down

0 comments on commit c3b44fa

Please sign in to comment.