From 2d2655d089a9f0b72ec6d9f1e8ecf0c880eb3dab Mon Sep 17 00:00:00 2001 From: Benoit Lavenier <benoit.lavenier@e-is.pro> Date: Fri, 12 May 2023 09:57:47 +0200 Subject: [PATCH] [fix] Avoid error when /node/summary failed [fix] When no timeout defined, audetect it --- www/js/services/bma-services.js | 4 ++-- www/js/services/network-services.js | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/www/js/services/bma-services.js b/www/js/services/bma-services.js index 213a9fae7..ff37f4da3 100644 --- a/www/js/services/bma-services.js +++ b/www/js/services/bma-services.js @@ -266,8 +266,8 @@ angular.module('cesium.bma.services', ['ngApi', 'cesium.http.services', 'cesium. else { console.debug('[BMA] Unknown node software [{0} v{1}]: could not check compatibility.'.format(software || '?', json.duniter.version || '?')); } - if (!isCompatible) { - console.error('[BMA] Incompatible node [{0} v{1}]: expected at least v{2}'.format(software, json.duniter.version, csSettings.data.minVersion)); + if (!isCompatible && json && json.duniter) { + console.error('[BMA] Incompatible node [{0} v{1}]: expected at least v{2}'.format(software, json.duniter.version || '?', csSettings.data.minVersion)); } return isCompatible; }) diff --git a/www/js/services/network-services.js b/www/js/services/network-services.js index 28f62358a..8809c01ea 100644 --- a/www/js/services/network-services.js +++ b/www/js/services/network-services.js @@ -99,10 +99,9 @@ angular.module('cesium.network.services', ['ngApi', 'cesium.currency.services', */ getDefaultTimeout = function () { // Using timeout from settings - if (csSettings.data.expertMode) { - var timeout = csSettings.data.timeout || csConfig.timeout; - console.debug('[network] Using user defined timeout: {0}ms'.format(timeout)); - return timeout; + if (csSettings.data.expertMode && csSettings.data.timeout > 0) { + console.debug('[network] Using user defined timeout: {0}ms'.format(csSettings.data.timeout)); + return csSettings.data.timeout; } // Computing timeout from the connection type @@ -900,7 +899,7 @@ angular.module('cesium.network.services', ['ngApi', 'cesium.currency.services', options.timeout = angular.isDefined(options.timeout) ? options.timeout : getDefaultTimeout(); var now = Date.now(); - console.info('[network] Getting synchronized BMA peers...'); + console.info('[network] Getting synchronized BMA peers... (timeout: {0}ms)'.format(options.timeout)); var wasStarted = isStarted(); var pid = data.pid + 1; -- GitLab