basho / riak-nodejs-client

The Riak client for Node.js.
Apache License 2.0
72 stars 29 forks source link

After client.shutdown node healthcheck still runs [JIRA: CLIENTS-683] #117

Closed yuriscom closed 8 years ago

yuriscom commented 8 years ago

If connection to riak failed, i want to shutdown the client and expect that it will stop all riak processes, but it is still running and firing healthcheck errors every 30 seconds.

lukebakken commented 8 years ago

Hello,

Can you provide the code you're using to shut down the client? Thank you.

yuriscom commented 8 years ago

Hi, Thanks for your reply.

I'm doing something like:

   this.client = new Riak.Client(nodes);
        var self = this;
        this.client.ping(function(res){
            if (res.code == 'ECONNREFUSED') {

                winston.info("shutting down riak...");
                self.client.shutdown(function (state) {
                    if (state === Riak.Cluster.State.SHUTDOWN) {
                        winston.info("done.");
                    }
                });

            }
        })
lukebakken commented 8 years ago

Shutting down the client will be improved in the next release.

In the meantime, please see how the integration tests shut down the client and wait for the correct state:

https://github.com/basho/riak-nodejs-client/blob/v1.8.1/test/integration/kv/storevalue.js#L220

Basically, subscribe to the stateChange event and only continue when you see the Riak.Cluster.State.SHUTDOWN state.

Yes, I know this is clunky, which is why it will be fixed in 1.9

Basho-JIRA commented 8 years ago

Will be fixed in 1.9

_[posted via JIRA by Luke Bakken]_