From 834c71f5984e0b772757a021963bb04959ade435 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 2 Jun 2023 13:45:14 +0200 Subject: [PATCH] Continued: - don't unset last_status_code/last_error_details on any update of instance data --- fba.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fba.py b/fba.py index b45a019..95774e7 100644 --- a/fba.py +++ b/fba.py @@ -192,7 +192,7 @@ def is_cache_key_set(key: str, sub: str) -> bool: def is_primitive(var: any) -> bool: #print(f"DEBUG: var[]='{type(var)}' - CALLED!") - return type(var) in {int, str, float, bool} + return type(var) in {int, str, float, bool, NoneType} def set_instance_data(key: str, domain: str, value: any): #print(f"DEBUG: key='{key}',domain='{domain}',value[]='{type(value)}' - CALLED!") @@ -438,7 +438,7 @@ def update_instance_data(domain: str): raise ValueError(f"No fields have been set, but method invoked, domain='{domain}'") # DEBUG: print(f"DEBUG: sql_string='{sql_string}',fields()={len(fields)}") - sql = "UPDATE instances SET" + sql_string + " last_status_code = NULL, last_error_details = NULL, last_updated = TIME() WHERE domain = ? LIMIT 1" + sql = "UPDATE instances SET" + sql_string + " last_updated = TIME() WHERE domain = ? LIMIT 1" # DEBUG: print("DEBUG: sql:", sql) try: @@ -1176,6 +1176,8 @@ def add_instance(domain: str, origin: str, originator: str, path: str = None): if has_pending_instance_data(domain): # DEBUG: print(f"DEBUG: domain='{domain}' has pending nodeinfo being updated ...") + set_instance_data("last_status_code" , domain, None) + set_instance_data("last_error_details", domain, None) update_instance_data(domain) remove_pending_error(domain) -- 2.39.5