Skip to content
Snippets Groups Projects
Commit c3a50655 authored by vjrj's avatar vjrj
Browse files

Improved a bit node manager

parent 8494ee33
No related branches found
No related tags found
No related merge requests found
...@@ -82,9 +82,7 @@ class DuniterNodeManager { ...@@ -82,9 +82,7 @@ class DuniterNodeManager {
} }
endpoint = 'https://${endpoint.replaceAll(':443', '')}'; endpoint = 'https://${endpoint.replaceAll(':443', '')}';
_nodes.add(endpoint); _nodes.add(endpoint);
final Duration latency = await _pingNode(endpoint); final Duration latency = await _pingNode(endpoint);
if (_fastestNode == null || latency < _fastestLatency!) { if (_fastestNode == null || latency < _fastestLatency!) {
_fastestNode = endpoint; _fastestNode = endpoint;
_fastestLatency = latency; _fastestLatency = latency;
...@@ -99,9 +97,6 @@ class DuniterNodeManager { ...@@ -99,9 +97,6 @@ class DuniterNodeManager {
_resetNodeErrors(null); _resetNodeErrors(null);
} }
logger('Loaded ${_nodes.length} duniter nodes'); logger('Loaded ${_nodes.length} duniter nodes');
if (!kReleaseMode) {
logger(_nodes);
}
} catch (e) { } catch (e) {
logger('Error: $e'); logger('Error: $e');
rethrow; rethrow;
...@@ -149,7 +144,9 @@ class DuniterNodeManager { ...@@ -149,7 +144,9 @@ class DuniterNodeManager {
stopwatch.stop(); stopwatch.stop();
return stopwatch.elapsed; return stopwatch.elapsed;
} catch (e) { } catch (e) {
// Handle exception when node is unavailable // Handle exception when node is unavailable etc
logger('Node $node does not respond to ping $e');
_incrementNodeErrors(node);
return const Duration(days: 20); return const Duration(days: 20);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment