override async notifyHostListChanged()

in common/lib/plugins/failover/failover_plugin.ts [159:193]


  override async notifyHostListChanged(changes: Map<string, Set<HostChangeOptions>>): Promise<void> {
    if (!this.enableFailoverSetting) {
      return Promise.resolve();
    }

    // Log changes
    if (logger.level === "debug") {
      let str = "Changes:";
      for (const [key, values] of changes.entries()) {
        str = str.concat("\n");
        // Convert from int back into enum
        const valStr = Array.from(values)
          .map((x) => HostChangeOptions[x])
          .join(", ");
        str = str.concat(`\tHost '${key}': ${valStr}`);
      }
      logger.debug(str);
    }

    const currentHost = this.pluginService.getCurrentHostInfo();
    if (currentHost) {
      const url = currentHost.url;
      if (this.isHostStillValid(url, changes)) {
        return Promise.resolve();
      }

      for (const alias of currentHost.allAliases) {
        if (this.isHostStillValid(alias + "/", changes)) {
          return Promise.resolve();
        }
      }
    }
    logger.info(Messages.get("Failover.invalidHost", currentHost?.host ?? "empty host"));
    return Promise.resolve();
  }