Skip to content

Commit fb01d10

Browse files
committed
chore: address comments
1 parent 0162bac commit fb01d10

4 files changed

Lines changed: 9 additions & 8 deletions

File tree

common/lib/host_list_provider/monitoring/cluster_topology_monitor.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -433,18 +433,19 @@ export class ClusterTopologyMonitorImpl extends AbstractMonitor implements Clust
433433
// Update host monitors with the new instances in the topology.
434434
const hosts: HostInfo[] | null = this.hostMonitorsLatestTopology;
435435
if (hosts && !this.hostMonitorsStop) {
436-
hosts.forEach((hostInfo) => {
436+
for (const hostInfo of hosts) {
437437
if (!this.submittedHosts.get(hostInfo.host)) {
438438
const minimalServiceContainer = ServiceUtils.instance.createMinimalServiceContainerFrom(
439439
this.servicesContainer,
440440
this._monitoringProperties
441441
);
442-
minimalServiceContainer.pluginManager.init();
442+
await minimalServiceContainer.pluginManager.init();
443+
// Intentionally not calling await on hostMonitor.run().
443444
const hostMonitor = new HostMonitor(minimalServiceContainer, this, hostInfo, this.writerHostInfo);
444445
const promise = hostMonitor.run();
445446
this.submittedHosts.set(hostInfo.host, promise);
446447
}
447-
});
448+
}
448449
}
449450
}
450451
}

common/lib/partial_plugin_service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import { PluginService } from "./plugin_service";
1818
import { HostInfo } from "./host_info";
1919
import { AwsClient } from "./aws_client";
20-
import { HostListProvider } from "./host_list_provider/host_list_provider";
20+
import { DynamicHostListProvider, HostListProvider } from "./host_list_provider/host_list_provider";
2121
import { ConnectionUrlParser } from "./utils/connection_url_parser";
2222
import { DatabaseDialect } from "./database_dialect/database_dialect";
2323
import { HostInfoBuilder } from "./host_info_builder";
@@ -296,7 +296,7 @@ export class PartialPluginService implements PluginService, HostListProviderServ
296296
}
297297

298298
try {
299-
const updatedHostList = await (hostListProvider as any).forceMonitoringRefresh(shouldVerifyWriter, timeoutMs);
299+
const updatedHostList = await (hostListProvider as DynamicHostListProvider).forceMonitoringRefresh(shouldVerifyWriter, timeoutMs);
300300
if (updatedHostList) {
301301
this.updateHostAvailability(updatedHostList);
302302
this.setHostList(this.hosts, updatedHostList);

common/lib/plugin_manager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ export class PluginManager {
442442

443443
for (const p of this._plugins) {
444444
if (p instanceof iface) {
445-
return p as any;
445+
return p as T;
446446
}
447447
}
448448
return null;

common/lib/plugins/failover2/failover2_plugin.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -469,8 +469,8 @@ export class Failover2Plugin extends AbstractConnectionPlugin {
469469
}
470470

471471
this.failoverMode = failoverModeFromValue(WrapperProperties.FAILOVER_MODE.get(this.properties));
472-
const initialHostInfo: HostInfo = this.hostListProviderService.getInitialConnectionHostInfo();
473-
this.rdsUrlType = this.rdsHelper.identifyRdsType(initialHostInfo.host);
472+
const initialHostInfo: HostInfo | undefined | null = this.hostListProviderService?.getInitialConnectionHostInfo();
473+
this.rdsUrlType = this.rdsHelper.identifyRdsType(initialHostInfo?.host);
474474

475475
if (this.failoverMode === FailoverMode.UNKNOWN) {
476476
this.failoverMode = this.rdsUrlType === RdsUrlType.RDS_READER_CLUSTER ? FailoverMode.READER_OR_WRITER : FailoverMode.STRICT_WRITER;

0 commit comments

Comments
 (0)