Reputation: 2387
Im trying to run the Python server/node.js client HelloWorld example from the ZeroRPC website. All the revelant libraries seemed to have been installed correctly, but when running the example I get the error:
{ name: 'HeartbeatError',
message: 'Lost remote after 10000ms',
traceback: '' }
Has anyone seen this?
Upvotes: 1
Views: 2022
Reputation: 707
If you can, use gevent.sleep to let zerorpc enough time to process waiting messages, including heartbeat.
Upvotes: 0
Reputation: 3272
I'm using "zerorpc": "^0.9.3" I come across with the same issue when I was running a time-consuming python code. The way to solve the issue is that you need to modify the library code of zerorpc: node_modules -> zerorpc -> lib -> channel.js Change the cooresponding method to
//Runs the heartbeat on this channel
Channel.prototype._runHeartbeat = function() {
var self = this;
return setInterval(function() {
if(util.curTime() > self._heartbeatExpirationTime) {
//If we haven't received a response in 2 * heartbeat rate, send an
//error
// self.emit("heartbeat-error", "Lost remote after " + (HEARTBEAT * 2) + "ms");
// self.close();
}
//Heartbeat on the channel
try {
var event = events.create(self._envelope, self._createHeader(), "_zpc_hb", [0]);
self._socket.send(event);
} catch(e) {
console.error("Error occurred while sending heartbeat:", e);
}
}, HEARTBEAT);
};
In the latest code from github: https://github.com/dotcloud/zerorpc-node they have solved this issue.
Upvotes: 2