From 65c29a1fa216d5b4d80cd9f66ac1ca7dc8e7bdf0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 29 Jul 2024 22:25:58 +0200 Subject: [PATCH] Continued: - update instance when error has happened (ops, missed this) - also output warning when fields list is empty --- fba/commands.py | 1 + fba/models/instances.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/fba/commands.py b/fba/commands.py index 45bfbd7..8715061 100644 --- a/fba/commands.py +++ b/fba/commands.py @@ -1075,6 +1075,7 @@ ORDER BY total_peers DESC, last_response_time ASC, last_updated ASC" except network.exceptions as exception: logger.warning("Exception '%s' during fetching instances (fetch_instances) from domain='%s'", type(exception), domain) instances.set_last_error(domain, exception) + instances.update(domain) logger.debug("Success - EXIT!") return 0 diff --git a/fba/models/instances.py b/fba/models/instances.py index 788f403..ff3c0fc 100644 --- a/fba/models/instances.py +++ b/fba/models/instances.py @@ -140,7 +140,7 @@ def update(domain: str): sql_string += f" {key} = ?," logger.debug("sql_string(%d)='%s'", len(sql_string), sql_string) - if sql_string == "": + if sql_string == "" or len(fields) == 0: raise ValueError(f"No fields have been set, but function invoked, domain='{domain}'") # Set last_updated to current timestamp -- 2.39.5