From 5b9f3a70f9c3348dfa3632720f4773a478908c72 Mon Sep 17 00:00:00 2001 From: mathiasg Date: Mon, 13 Jun 2022 16:39:59 -0400 Subject: [PATCH] FIX: Avoid excessive etelemetry calls In cases where `check_latest_version` returned None, each time `BaseInterface.__init__` was called would lead to another server ping. This avoids this loop by falling to a string, n/a, if the server fails to produce a version. --- nipype/__init__.py | 2 +- nipype/interfaces/base/core.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nipype/__init__.py b/nipype/__init__.py index bf6968a95a..06084e823a 100644 --- a/nipype/__init__.py +++ b/nipype/__init__.py @@ -98,4 +98,4 @@ def check_latest_version(raise_exception=False): from .interfaces.base import BaseInterface if BaseInterface._etelemetry_version_data is None: - BaseInterface._etelemetry_version_data = check_latest_version() + BaseInterface._etelemetry_version_data = check_latest_version() or "n/a" diff --git a/nipype/interfaces/base/core.py b/nipype/interfaces/base/core.py index 69d621bbc1..c8099be630 100644 --- a/nipype/interfaces/base/core.py +++ b/nipype/interfaces/base/core.py @@ -186,7 +186,7 @@ def __init__( from ... import check_latest_version if BaseInterface._etelemetry_version_data is None: - BaseInterface._etelemetry_version_data = check_latest_version() + BaseInterface._etelemetry_version_data = check_latest_version() or "n/a" if not self.input_spec: raise Exception("No input_spec in class: %s" % self.__class__.__name__)