Skip to content

Commit 2262209

Browse files
committed
fix internal error
1 parent 5f95f59 commit 2262209

File tree

1 file changed

+23
-20
lines changed

1 file changed

+23
-20
lines changed

checker/src/checker.py

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,26 +1385,29 @@ async def fetch_five():
13851385
keys = []
13861386
loop = asyncio.get_running_loop()
13871387
for _ in range(5):
1388-
resp = await con.client.get(f"/text?era={era}")
1389-
resp.raise_for_status()
1390-
d = resp.json()
1391-
source = d["source"]
1392-
book = int(d["book"])
1393-
paragraph = int(d["paragraph"])
1394-
text = d["text"]
1395-
text_db = await loop.run_in_executor(
1396-
None, lambda: get_text(era, source, book, paragraph)
1397-
)
1398-
if text_db is None:
1399-
con.log_debug("Text from DB returned None")
1400-
raise MumbleException("Failed to get text")
1401-
if text_db != text:
1402-
con.log_debug(
1403-
f"Text from DB doesn't match. DB: {
1404-
text_db} | Actual: {text}"
1388+
try:
1389+
resp = await con.client.get(f"/text?era={era}")
1390+
resp.raise_for_status()
1391+
d = resp.json()
1392+
source = d["source"]
1393+
book = int(d["book"])
1394+
paragraph = int(d["paragraph"])
1395+
text = d["text"]
1396+
text_db = await loop.run_in_executor(
1397+
None, lambda: get_text(era, source, book, paragraph)
14051398
)
1406-
raise MumbleException("Failed to get text")
1407-
keys.append((source, book, paragraph))
1399+
if text_db is None:
1400+
con.log_debug("Text from DB returned None")
1401+
raise MumbleException("Failed to get text")
1402+
if text_db != text:
1403+
con.log_debug(
1404+
f"Text from DB doesn't match. DB: {
1405+
text_db} | Actual: {text}"
1406+
)
1407+
raise MumbleException("Failed to get text")
1408+
keys.append((source, book, paragraph))
1409+
except Exception as e:
1410+
con.log_error("Failed text validation", e)
14081411
return keys
14091412

14101413
batch1 = await fetch_five()
@@ -1417,7 +1420,7 @@ async def fetch_five():
14171420
max_combined = Counter(combined).most_common(1)[0][1]
14181421
con.log_debug(f"Combined max duplicate count: {max_combined}")
14191422
if max_combined > len(combined) // 2:
1420-
con.log_error(
1423+
logger.error(
14211424
f"Endpoint failed variability test: combined duplicates "
14221425
f">{len(combined)//2} (count={max_combined})"
14231426
)

0 commit comments

Comments
 (0)