in common/lib/plugins/limitless/limitless_router_monitor.ts [79:115]
async run(): Promise<void> {
logger.debug(Messages.get("LimitlessRouterMonitor.running", this.hostInfo.host));
while (!this.stopped) {
const telemetryContext = this.telemetryFactory.openTelemetryContext("limitless router monitor task", TelemetryTraceLevel.TOP_LEVEL);
telemetryContext.setAttribute("url", this.hostInfo.host);
await telemetryContext.start(async () => {
try {
await this.openConnection();
if (!this.monitoringClient) {
return;
}
const clientIsValid = await this.pluginService.isClientValid(this.monitoringClient);
if (!clientIsValid) {
this.monitoringClient = null;
return;
}
const newLimitlessRouters = await this.queryHelper.queryForLimitlessRouters(this.pluginService, this.monitoringClient, this.hostInfo);
if (newLimitlessRouters && newLimitlessRouters.length > 0) {
this.limitlessRouterCache.put(
this.limitlessRouterCacheKey,
newLimitlessRouters,
BigInt(WrapperProperties.MONITOR_DISPOSAL_TIME_MS.get(this.props))
);
RoundRobinHostSelector.setRoundRobinHostWeightPairsProperty(newLimitlessRouters, this.props);
logger.debug(logTopology(newLimitlessRouters, "[limitlessRouterMonitor] "));
}
await sleep(this.intervalMillis);
} catch (e: any) {
logger.debug(Messages.get("LimitlessRouterMonitor.errorDuringMonitoringStop", this.hostInfo.host, e.message));
}
});
}
}