From 766b87a08062219d656a2fb4fa9e1e649a538483 Mon Sep 17 00:00:00 2001 From: mashehu Date: Fri, 26 May 2023 11:48:01 +0200 Subject: [PATCH] improved version of the async call --- nf_core/utils.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/nf_core/utils.py b/nf_core/utils.py index 7774265bd..28a6e3f54 100644 --- a/nf_core/utils.py +++ b/nf_core/utils.py @@ -79,16 +79,18 @@ def check_if_outdated(current_version=None, remote_version=None, source_url="htt # Build the URL to check against source_url = os.environ.get("NFCORE_VERSION_URL", source_url) source_url = f"{source_url}?v={current_version}" - - # Fetch the remote version asynchronously - with concurrent.futures.ThreadPoolExecutor() as executor: - future = executor.submit(fetch_remote_version, source_url) - # Retrieve the remote version in the background - remote_version = future.result() + # check if we have a newer version without blocking the rest of the script is_outdated = False + remote_version = None + try: + with concurrent.futures.ThreadPoolExecutor() as executor: + future = executor.submit(fetch_remote_version, source_url) + remote_version = future.result() + except Exception as e: + log.debug(f"Could not check for nf-core updates: {e}") if remote_version is not None: - # Check if we have an available update - is_outdated = Version(remote_version) > Version(current_version) + if Version(remote_version) > Version(current_version): + is_outdated = True return (is_outdated, current_version, remote_version)