@@ -389,6 +389,7 @@ export class ClusterTopologyMonitorImpl extends AbstractMonitor implements Clust
389389 await this . closeHostMonitors ( ) ;
390390
391391 if ( ! ( hosts !== null && ! this . isVerifiedWriterConnection ) ) {
392+ await this . delay ( true ) ;
392393 continue ;
393394 }
394395
@@ -417,7 +418,7 @@ export class ClusterTopologyMonitorImpl extends AbstractMonitor implements Clust
417418 this . monitoringClient = writerClient ;
418419 this . writerHostInfo = writerClientHostInfo ;
419420 this . isVerifiedWriterConnection = true ;
420- this . highRefreshRateEndTimeNs = getTimeInNanos ( ) + this . highRefreshRateEndTimeNs ;
421+ this . highRefreshRateEndTimeNs = getTimeInNanos ( ) + BigInt ( this . highRefreshRateNs ) ;
421422
422423 this . hostMonitorsStop = true ;
423424 await this . closeHostMonitors ( ) ;
@@ -426,14 +427,20 @@ export class ClusterTopologyMonitorImpl extends AbstractMonitor implements Clust
426427 this . readerTopologiesById . clear ( ) ;
427428 this . completedOneCycle . clear ( ) ;
428429
430+ await this . delay ( true ) ;
429431 continue ;
430432 } else {
431433 // Update host monitors with the new instances in the topology.
432434 const hosts : HostInfo [ ] | null = this . hostMonitorsLatestTopology ;
433435 if ( hosts && ! this . hostMonitorsStop ) {
434436 hosts . forEach ( ( hostInfo ) => {
435437 if ( ! this . submittedHosts . get ( hostInfo . host ) ) {
436- const hostMonitor = new HostMonitor ( this . servicesContainer , this , hostInfo , this . writerHostInfo ) ;
438+ const minimalServiceContainer = ServiceUtils . instance . createMinimalServiceContainerFrom (
439+ this . servicesContainer ,
440+ this . _monitoringProperties
441+ ) ;
442+ minimalServiceContainer . pluginManager . init ( ) ;
443+ const hostMonitor = new HostMonitor ( minimalServiceContainer , this , hostInfo , this . writerHostInfo ) ;
437444 const promise = hostMonitor . run ( ) ;
438445 this . submittedHosts . set ( hostInfo . host , promise ) ;
439446 }
@@ -462,6 +469,7 @@ export class ClusterTopologyMonitorImpl extends AbstractMonitor implements Clust
462469 await this . closeConnection ( clientToClose ) ;
463470 this . isVerifiedWriterConnection = false ;
464471 this . writerHostInfo = null ;
472+ await this . delay ( false ) ;
465473 continue ;
466474 }
467475
@@ -725,9 +733,9 @@ export class HostMonitor {
725733 // Successfully updated the host monitor writer connection.
726734 logger . debug ( Messages . get ( "HostMonitor.detectedWriter" , this . hostInfo . hostId , this . hostInfo . url ) ) ;
727735
728- this . servicesContainer
729- . importantEventService
730- . registerEvent ( ( ) => Messages . get ( "HostMonitor.detectedWriter" , this . hostInfo . hostId , this . hostInfo . url ) ) ;
736+ this . servicesContainer . importantEventService . registerEvent ( ( ) =>
737+ Messages . get ( "HostMonitor.detectedWriter" , this . hostInfo . hostId , this . hostInfo . url )
738+ ) ;
731739
732740 await this . monitor . fetchTopologyAndUpdateCache ( this . client ) ;
733741 this . hostInfo . setAvailability ( HostAvailability . AVAILABLE ) ;
0 commit comments