fix prod hang

This commit is contained in:
C committed 2026-01-05 16:41:25 -08:00
1 parent 2da61539cc
commit a6e2397046
1 file changed
+10 -1
+10 -1
View File
@@ -124,8 +124,9 @@ async def get_item_by_variation_id(variation_id: str) -> dict:
cursor = None
page_count = 0
max_pages = 50 # Safety limit to prevent infinite loops
while True:
while page_count < max_pages:
page_count += 1
print(f"[@DEBUG] Searching page {page_count}...")
@@ -151,6 +152,7 @@ async def get_item_by_variation_id(variation_id: str) -> dict:
raise ValueError(f"No items found in LEGO category")
else:
# No more results
print(f"[@DEBUG] No more results on page {page_count}")
break
# Search through items on this page to find which has this variation
@@ -188,8 +190,15 @@ async def get_item_by_variation_id(variation_id: str) -> dict:
cursor = result_json.get("cursor")
if not cursor:
# No more pages
print(f"[@DEBUG] No more pages after page {page_count}")
break
# If we get here, variation wasn't found
if page_count >= max_pages:
raise ValueError(
f"Variation {variation_id} not found after searching {max_pages} pages (possible infinite loop prevented)"
)
raise ValueError(
f"Variation {variation_id} not found in any LEGO category item (searched {page_count} pages)"
)