Skip to content

Commit

Permalink
Iterate the index counter whenever a GitLab API request is made
Browse files Browse the repository at this point in the history
For any HTTP request of type POST or PUT, the index counter is incremented by 1 to ensure that the attempts are kept track of to compare against the maximum possible number of attempts required to break the rate limit on the API requests

Signed-off-by: Akashdeep Dhar <akashdeep.dhar@gmail.com>
  • Loading branch information
gridhead committed Nov 20, 2023
1 parent 12e465f commit 7d3beeb
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pagure_exporter/work/tkts.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ def iteriden(self, tkid):
def itertkts(self, dictobjc):
try:
strttime = time.time()
standard.rateindx += 1
standard.issuname = dictobjc["title"]
standard.issuiden = dictobjc["id"]
standard.isclosed = True if dictobjc["status"] == "Closed" else False
Expand Down Expand Up @@ -186,6 +187,7 @@ def itertkts(self, dictobjc):
def itercmts(self, dictobjc):
try:
strttime = time.time()
standard.rateindx += 1
standard.cmtsiden = dictobjc["id"]
standard.cmtslink = f"{standard.issulink}#comment-{standard.cmtsiden}"
standard.cmtsauth = dictobjc["user"]["fullname"]
Expand Down Expand Up @@ -233,6 +235,7 @@ def itercmts(self, dictobjc):
def iterstat(self):
try:
strttime, respcode, respresn = time.time(), 0, ""
standard.rateindx += 1
if standard.isclosed:
rqstdata = {"state_event": "close"}
response = requests.put(
Expand Down

0 comments on commit 7d3beeb

Please sign in to comment.