0rpc/zerorpc-node

Setting heartbeatInterval is not working.!

gwthm-in opened this issue · 4 comments

I'm constructing

var zerorpc = require("zerorpc");
var client = new zerorpc.Client({heartbeatInterval: 0});
client.connect("tcp://127.0.0.1:4242");

But it seems, it has no effect?

I'm still getting.. ERROR: HeartbeatError: Lost remote after -10000ms

You are asking for a heartbeat of 0 second. zerorpc returns a Lost remote error after two missed heartbeats. Thus zerorpc waits 0*2 = 0 seconds for the server's heartbeat. Also note the heartbeat must be identical between the server and the client. Else one will think the other is not responding.

In normal operation you shouldn't need to change the default heartbeat interval.

@bombela Thanks for the update.

With Python lib is possible to disable hearbeat but not in this module (0rpc/node).
Is there a reason ?

Client side:

var heartbeat = options.heartbeatInterval || DEFAULT_HEARTBEAT;

Server side:

var heartbeat = heartbeat || DEFAULT_HEARTBEAT;

If we pass null value, we got the default value :(

Yeah logic in the code doesn't support this. PRs are welcome :)