From 34ce2844c0aa6d35c3ba098f195a81a8fccda733 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Luka=20=C5=A0ijanec?= Date: Mon, 7 Nov 2022 01:19:40 +0100 Subject: increased how many failed acsms not 200 in a row to stop to 100 --- gather.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gather.py b/gather.py index e656b03..8ce676e 100755 --- a/gather.py +++ b/gather.py @@ -64,6 +64,7 @@ only_isbn_acsms = 0 failed_acsms = 0 failed_acsms_not200 = 0 failed_acsms_not200_in_a_row = 0 +hmfan2iarts = 100 # how many failed acsms not 200 in a row to stop try: with Session(engine) as session: @@ -84,12 +85,12 @@ try: if (r.status_code == 200): failed_acsms_not200_in_a_row = 0 if r.status_code != 200: - logger.warning(f"received http response with error code not 200 (it is {r.status_code}). if this continues for {10-failed_acsms_not200_in_a_row} more requests, I'll assume there are no more borrows on the server.") + logger.warning(f"received http response with error code not 200 (it is {r.status_code}). if this continues for {hmfan2iarts-failed_acsms_not200_in_a_row} more requests, I'll assume there are no more borrows on the server.") failed_acsms_not200 += 1 failed_acsms_not200_in_a_row += 1 force_acsm_id = acsm_id+1 - if failed_acsms_not200_in_a_row == 10: - logger.info(f"we are done for now, as server responded with {r.status_code} for queried acsm id {acsm_id}, which means 10 concurrent responses that are not 200.") + if failed_acsms_not200_in_a_row == hmfan2iarts: + logger.info(f"we are done for now, as server responded with {r.status_code} for queried acsm id {acsm_id}, which means {hmfan2iarts} concurrent responses that are not 200.") if acsm_id < guaranteed_large_acsm_id: logger.error(f"this shouldn't happen. I have a hardcoded value that tells me that at time of program writing, acsm id {guaranteed_large_acsm_id} did exist on the server. dying anyways.") break -- cgit v1.2.3