nsqjs
nsqjs copied to clipboard
Connection error event never fired if Reader initialised with `lookupdHTTPAddresses`
Hi,
If I initialise Reader with lookupdHTTPAddresses variable set to garbage
const reader = new nsq.Reader('test', 'test2', {
lookupdHTTPAddresses: 'garbage:9999',
});
const handler = () => {
console.log('!!!handler fired!!');
process.exit();
};
reader.on('error', handler);
reader.on('message', handler);
reader.on('discard', handler);
reader.on('nsqd_connected', handler);
reader.on('nsqd_closed', handler);
reader.connect();
The error event is never dispatched.
If I initialise with nsqdTCPAddresses it works as expected.
Is it a bug?
I found the culprit: https://github.com/dudleycarr/nsqjs/blob/master/lib/lookupd.js#L39
I'll get a fix in for that over the weekend.
Please check this line as well https://github.com/dudleycarr/nsqjs/blob/master/lib/lookupd.js#L53 It seems to not pass the error down.
Bump - I've just hit this bug too.