Skip to content

Commit

Permalink
wip: debug
Browse files Browse the repository at this point in the history
  • Loading branch information
jthodge committed Oct 17, 2023
1 parent 0d0aa95 commit 3e63d1b
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions build_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,13 @@ def build_database(repo_path):
retries = 0
response = None

while retries < 10:
while retries < 3:
headers = {}
if os.environ.get("GITHUB_TOKEN"):
headers = {
"authorization": "Bearer {}".format(os.environ["GITHUB_TOKEN"])
}

print("!" * 80)
print(headers)

response = httpx.post(
"https://api.github.com/markdown",
json={
Expand All @@ -91,15 +88,14 @@ def build_database(repo_path):

if response.status_code == 200:
record["html"] = response.text
time.sleep(10)
print("Rendered HTML for {}".format(path))
break
elif response.status_code == 401:
assert False, "401 Unauthorized returned from GitHub API when rendering markdown"
else:
print(response.status_code, response.headers)
print(" sleeping 90s")
time.sleep(90)
print(" sleeping 60s")
time.sleep(60)
retries += 1
else:
assert False, "Could not render {} - last response was {}".format(
Expand Down

0 comments on commit 3e63d1b

Please sign in to comment.