summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Luka Šijanec <anton@sijanec.eu>2022-11-07 01:19:40 +0100
committerAnton Luka Šijanec <anton@sijanec.eu>2022-11-07 01:19:40 +0100
commit34ce2844c0aa6d35c3ba098f195a81a8fccda733 (patch)
tree5fb0a56f40c4770c23e8d4925818576ec8b409e5
parentserver can also return 'no distribution rights' (diff)
downloadbiblos-stat-34ce2844c0aa6d35c3ba098f195a81a8fccda733.tar
biblos-stat-34ce2844c0aa6d35c3ba098f195a81a8fccda733.tar.gz
biblos-stat-34ce2844c0aa6d35c3ba098f195a81a8fccda733.tar.bz2
biblos-stat-34ce2844c0aa6d35c3ba098f195a81a8fccda733.tar.lz
biblos-stat-34ce2844c0aa6d35c3ba098f195a81a8fccda733.tar.xz
biblos-stat-34ce2844c0aa6d35c3ba098f195a81a8fccda733.tar.zst
biblos-stat-34ce2844c0aa6d35c3ba098f195a81a8fccda733.zip
-rwxr-xr-xgather.py7
1 files 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