@@ -440,12 +440,10 @@ class NodesMonitor extends EventEmitter {
440440 item . node . is_internal_node = true ;
441441 }
442442 dbg . log0 ( '_add_new_node' , item . node ) ;
443+ this . _set_need_update . add ( item ) ;
443444 this . _add_node_to_maps ( item ) ;
444445 this . _set_node_defaults ( item ) ;
445446 this . _set_connection ( item , conn ) ;
446- this . _set_need_update . add ( item ) ;
447- // we hurry the next run to save the new node
448- this . _schedule_next_run ( 3000 ) ;
449447 }
450448
451449 _add_node_to_maps ( item ) {
@@ -510,6 +508,8 @@ class NodesMonitor extends EventEmitter {
510508 dbg . warn ( '_close_node_connection' , item . node . name , item . connection . connid ) ;
511509 item . connection . close ( ) ;
512510 item . connection = null ;
511+ item . agent_info = null ;
512+ item . node . rpc_address = '' ;
513513 }
514514
515515 _disconnect_node ( item ) {
@@ -528,6 +528,7 @@ class NodesMonitor extends EventEmitter {
528528 item . node . heartbeat = Date . now ( ) ;
529529 this . _set_need_update . add ( item ) ;
530530 this . _update_status ( item ) ;
531+ this . _run_node_delayed ( item ) ;
531532 }
532533
533534 _on_connection_close ( item , conn ) {
@@ -611,6 +612,11 @@ class NodesMonitor extends EventEmitter {
611612 } ) ) ;
612613 }
613614
615+ _run_node_delayed ( item ) {
616+ return P . delay ( 100 )
617+ . then ( ( ) => this . _run_node ( item ) ) ;
618+ }
619+
614620 _get_agent_info ( item ) {
615621 if ( ! item . connection ) return ;
616622 dbg . log0 ( '_get_agent_info:' , item . node . name ) ;
@@ -754,6 +760,7 @@ class NodesMonitor extends EventEmitter {
754760
755761 _test_network_to_server ( item ) {
756762 if ( ! item . connection ) return ;
763+ if ( ! item . node . rpc_address ) return ;
757764
758765 const start = Date . now ( ) ;
759766
@@ -783,6 +790,7 @@ class NodesMonitor extends EventEmitter {
783790 // Test with few other nodes and detect if we have a NAT preventing TCP to this node
784791 _test_network_perf ( item ) {
785792 if ( ! item . connection ) return ;
793+ if ( ! item . node . rpc_address ) return ;
786794
787795 const items_without_issues = this . _get_detention_test_nodes ( item , config . NODE_IO_DETENTION_TEST_NODES ) ;
788796 return P . each ( items_without_issues , item_without_issues => {
@@ -1123,6 +1131,7 @@ class NodesMonitor extends EventEmitter {
11231131 item . online &&
11241132 item . trusted &&
11251133 item . node_from_store &&
1134+ item . node . rpc_address &&
11261135 ! item . io_detention &&
11271136 ! item . node . migrating_to_pool &&
11281137 ! item . node . decommissioning &&
@@ -1134,6 +1143,7 @@ class NodesMonitor extends EventEmitter {
11341143 item . online &&
11351144 item . trusted &&
11361145 item . node_from_store &&
1146+ item . node . rpc_address &&
11371147 ! item . io_detention &&
11381148 ! item . node . decommissioned && // but readable when decommissioning !
11391149 ! item . node . deleting &&
@@ -1143,6 +1153,7 @@ class NodesMonitor extends EventEmitter {
11431153 item . online &&
11441154 item . trusted &&
11451155 item . node_from_store &&
1156+ item . node . rpc_address &&
11461157 ! item . io_detention &&
11471158 ! item . storage_full &&
11481159 ! item . node . migrating_to_pool &&
0 commit comments