From be4c83bfb0bfb304b57c153852dd1e03d7477b3e Mon Sep 17 00:00:00 2001
From: Cynthia Foxwell <gamers@riseup.net>
Date: Tue, 11 Feb 2025 13:15:17 -0700
Subject: [PATCH] i tried my hardest to ratelimit myself locally and it didnt
 work so this code fixes ratelimit issues :)

---
 src/apiutils.nim | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/apiutils.nim b/src/apiutils.nim
index 74ca646..c5fe79b 100644
--- a/src/apiutils.nim
+++ b/src/apiutils.nim
@@ -125,7 +125,7 @@ template fetchImpl(result, additional_headers, fetchBody) {.dirty.} =
   except OSError as e:
     raise e
   except Exception as e:
-    #echo "error: ", e.name, ", msg: ", e.msg, ", token: ", token[], ", url: ", url
+    echo "error: ", e.name, ", msg: ", e.msg, ", url: ", url
     #if "length" notin e.msg and "descriptor" notin e.msg:
       #release(token, invalid=true)
     raise rateLimitError()
@@ -138,7 +138,7 @@ template retry(bod) =
     bod
 
 proc fetch*(url: Uri; api: Api; additional_headers: HttpHeaders = newHttpHeaders()): Future[JsonNode] {.async.} =
-  retry:
+  #retry:
     var body: string
     fetchImpl(body, additional_headers):
       if body.startsWith('{') or body.startsWith('['):
@@ -156,7 +156,7 @@ proc fetch*(url: Uri; api: Api; additional_headers: HttpHeaders = newHttpHeaders
         raise rateLimitError()
 
 proc fetchRaw*(url: Uri; api: Api; additional_headers: HttpHeaders = newHttpHeaders()): Future[string] {.async.} =
-  retry:
+  #retry:
     fetchImpl(result, additional_headers):
       if not (result.startsWith('{') or result.startsWith('[')):
         echo resp.status, ": ", result, " --- url: ", url