From: Roland Häder Date: Tue, 23 May 2023 23:13:36 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=fcfd5adb0b0a40bb659b56deede2646f7c7857a3;p=fba.git Continued: - ops, my mistake to remove array element while it is still needed --- diff --git a/fba.py b/fba.py index 210abab..aa9c1ab 100644 --- a/fba.py +++ b/fba.py @@ -142,12 +142,14 @@ def update_last_error(domain: str, res: any): # NOISY-DEBUG: print("DEBUG: AFTER res[]:", type(res)) if type(res) is str: + # NOISY-DEBUG: print(f"DEBUG: Setting last_error_details='{res}'"); cursor.execute("UPDATE instances SET last_status_code = 999, last_error_details = ?, last_updated = ? WHERE domain = ? LIMIT 1", [ res, time.time(), domain ]) else: + # NOISY-DEBUG: print(f"DEBUG: Setting last_error_details='{res.reason}'"); cursor.execute("UPDATE instances SET last_status_code = ?, last_error_details = ?, last_updated = ? WHERE domain = ? LIMIT 1", [ res.status_code, res.reason, @@ -163,8 +165,6 @@ def update_last_error(domain: str, res: any): print("ERROR: failed SQL query:", domain, e) sys.exit(255) - # NOISY-DEBUG: print(f"DEBUG: Deleting domain='{domain}' from pending_errors") - del pending_errors[domain] # NOISY-DEBUG: print("DEBUG: EXIT!") def update_last_nodeinfo(domain: str): @@ -417,7 +417,7 @@ def update_block_reason(reason: str, blocker: str, blocked: str, block_level: st if cursor.rowcount == 0: print("WARNING: Did not update any rows:", domain) - except baseException as e: + except BaseException as e: print("ERROR: failed SQL query:", reason, blocker, blocked, block_level, e) sys.exit(255) @@ -615,7 +615,7 @@ def get_friendica_blocks(domain: str) -> dict: reqto.get(f"https://{domain}/friendica", headers=headers, timeout=(config["connection_timeout"], config["read_timeout"])).text, "html.parser", ) - except baseException as e: + except BaseException as e: print("WARNING: Failed to fetch /friendica from domain:", domain, e) update_last_error(domain, e) return {}