How to use the node-zookeeper-client.State.DISCONNECTED function in node-zookeeper-client

To help you get started, we’ve selected a few node-zookeeper-client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github apache / dubbo-js / packages / dubbo / src / registry / zookeeper.ts View on Github external
this._checkTimer = setInterval(() => {
      const state = this._client.getState();
      switch (state) {
        case State.EXPIRED:
        case State.DISCONNECTED:
          log(`checker is error, state is ${state}, need reconnect`);
          this._reconnect();
          break;
        default:
          log(`checker is ok, state is ${state}`);
      }
    }, CHECK_TIME);
  }