Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'connect' event is emitted multiple times #40

Open
srcshelton opened this issue Feb 10, 2015 · 0 comments
Open

'connect' event is emitted multiple times #40

srcshelton opened this issue Feb 10, 2015 · 0 comments

Comments

@srcshelton
Copy link

(Possibly related to Issue #3 from 2012?)

I have a trivial code sample:

var zkplus = require( 'zkplus' );

var client = zkplus.createClient({
          connect: false
        , servers: [{
                  host: 'registry1'
                , port:  2401
          }]
        , timeout: 30000
});

client.on( 'connect', function() {
        console.log( 'DEBUG: connect called' );

        client.readdir('/', function( error, nodes ) {
                if( error ) {
                        console.log( 'Read error: ' + error );
                } else {
                        console.log( nodes.join() );
                }
                client.close();
        });
});

client.on( 'error', function( error ) {
        console.log( 'General error: ' + error );
});

client.connect( function( error ) {
        console.log( 'Connection error: ' + error );
        process.exit( 1 );
});

... which, with ZooKeeper 3.4.5 and nodejs v0.10.32 on Ubuntu 12.04 LTS always outputs:

DEBUG: connect called
DEBUG: connect called
<list of zookeeper nodes>
Read error: ZooKeeperError: zookeeper is closing

If connect is set to 'true' and the client.connect() function-call is commented out, then the onConnect callback never seems to be triggered at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant