@@ -247,7 +247,7 @@ class NodesMonitor extends EventEmitter {
247
247
return P . resolve ( )
248
248
. then ( ( ) => this . _run ( ) )
249
249
. then ( ( ) => {
250
- // do nothing.
250
+ // do nothing.
251
251
} ) ;
252
252
}
253
253
@@ -1012,7 +1012,7 @@ class NodesMonitor extends EventEmitter {
1012
1012
} )
1013
1013
. then ( ( ) => this . _update_nodes_store ( 'force' ) )
1014
1014
. then ( ( ) => {
1015
- // do nothing.
1015
+ // do nothing.
1016
1016
} ) ;
1017
1017
}
1018
1018
@@ -1236,15 +1236,15 @@ class NodesMonitor extends EventEmitter {
1236
1236
if ( item . node . deleted ) return ;
1237
1237
if ( ! item . connection ) return ;
1238
1238
if ( ! item . agent_info ) return ;
1239
- //The node should be set as enable if it is not decommissioned.
1239
+ //The node should be set as enable if it is not decommissioned.
1240
1240
const should_enable = ! item . node . decommissioned ;
1241
1241
const item_pool = system_store . data . get_by_id ( item . node . pool ) ;
1242
1242
const location_info = {
1243
1243
node_id : String ( item . node . _id ) ,
1244
1244
host_id : String ( item . node . host_id ) ,
1245
1245
pool_id : String ( item . node . pool ) ,
1246
1246
} ;
1247
- // We should only add region if it is defined.
1247
+ // We should only add region if it is defined.
1248
1248
if ( item_pool && ! _ . isUndefined ( item_pool . region ) ) location_info . region = item_pool . region ;
1249
1249
// We should change the service enable field if the field is not equal to the decommissioned decision.
1250
1250
const service_enabled_not_changed = ( item . node . enabled === should_enable ) ;
@@ -3373,12 +3373,16 @@ class NodesMonitor extends EventEmitter {
3373
3373
'node' , item . node . name ,
3374
3374
'issues_report' , item . node . issues_report ,
3375
3375
'block_report' , block_report ) ;
3376
- // disconnect from the node to force reconnect
3377
- // only disconnect if enough time passed since last disconnect to avoid amplification of errors in R\W flows
3378
- const DISCONNECT_GRACE_PERIOD = 2 * 60 * 1000 ; // 2 minutes grace before another disconnect
3379
- if ( ! item . disconnect_time || item . disconnect_time + DISCONNECT_GRACE_PERIOD < Date . now ( ) ) {
3380
- dbg . log0 ( 'disconnecting node to force reconnect. node:' , item . node . name ) ;
3381
- this . _disconnect_node ( item ) ;
3376
+
3377
+
3378
+ if ( config . NODES_DISCONNECT_ON_ERROR ) {
3379
+ // disconnect from the node to force reconnect
3380
+ // only disconnect if enough time passed since last disconnect to avoid amplification of errors in R\W flows
3381
+ const DISCONNECT_GRACE_PERIOD = 2 * 60 * 1000 ; // 2 minutes grace before another disconnect
3382
+ if ( ! item . disconnect_time || item . disconnect_time + DISCONNECT_GRACE_PERIOD < Date . now ( ) ) {
3383
+ dbg . log0 ( 'disconnecting node to force reconnect. node:' , item . node . name ) ;
3384
+ this . _disconnect_node ( item ) ;
3385
+ }
3382
3386
}
3383
3387
}
3384
3388
}
0 commit comments