From 28f2a35b1c258d2d7a3b567c5cd727f6ff70da95 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Wed, 28 Jun 2023 06:43:21 +0200 Subject: [PATCH] Continued: - update instance data just before exiting federation.fetch_instances() --- fba/commands.py | 1 + fba/http/federation.py | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/fba/commands.py b/fba/commands.py index a915596..8812cf1 100644 --- a/fba/commands.py +++ b/fba/commands.py @@ -713,6 +713,7 @@ def fetch_instances(args: argparse.Namespace) -> int: except network.exceptions as exception: logger.warning("Exception '%s' during fetching instances (fetch_instances) from args.domain='%s'", type(exception), args.domain) instances.set_last_error(args.domain, exception) + instances.update_data(args.domain) return 100 if args.single: diff --git a/fba/http/federation.py b/fba/http/federation.py index 630b87b..844fe28 100644 --- a/fba/http/federation.py +++ b/fba/http/federation.py @@ -90,11 +90,6 @@ def fetch_instances(domain: str, origin: str, software: str, command: str, path: logger.debug("Invoking instances.set_total_peerlist(%s,%d) ...", domain, len(peerlist)) instances.set_total_peers(domain, peerlist) - logger.debug("Checking if domain='%s' has pending updates ...", domain) - if instances.has_pending(domain): - logger.debug("Flushing updates for domain='%s' ...", domain) - instances.update_data(domain) - logger.debug("peerlist[]='%s'", type(peerlist)) if peerlist is None: logger.warning("Cannot fetch peers: domain='%s'", domain) @@ -135,6 +130,11 @@ def fetch_instances(domain: str, origin: str, software: str, command: str, path: logger.debug("Invoking cookies.clear(%s) ...", domain) cookies.clear(domain) + logger.debug("Checking if domain='%s' has pending updates ...", domain) + if instances.has_pending(domain): + logger.debug("Flushing updates for domain='%s' ...", domain) + instances.update_data(domain) + logger.debug("EXIT!") def fetch_peers(domain: str, software: str, origin: str) -> list: -- 2.39.5