Python/Node ZeroRPC心跳

2024-06-16 15:01:48 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试运行Python服务器/节点.js来自ZeroRPCwebsite的客户机HelloWorld示例。所有相关的库似乎都已正确安装,但在运行示例时,我得到了一个错误:

{ name: 'HeartbeatError',
  message: 'Lost remote after 10000ms',
  traceback: '' }

有人看到这个吗?在


Tags: name服务器示例message客户机节点remote错误
2条回答

如果可以,使用睡觉吧让zerorpc有足够的时间来处理等待的消息,包括heartbeat。在

我正在使用“zerorpc”:“^0.9.3” 我在运行一个耗时的python代码时遇到了同样的问题。解决这个问题的方法是需要修改zerorpc的库代码: 节点\模块->零RPC->库->;频道.js 将协同响应方法更改为

//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);
};

在github的最新代码中:https://github.com/dotcloud/zerorpc-node 他们已经解决了这个问题。在

相关问题 更多 >