diff options
-rwxr-xr-x | gather.py | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -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 |