use*_*365 5 python zeromq node.js zerorpc
我正在尝试使用ZeroRPC python服务器和node.js客户端进行一些简单的负载测试。我注意到的是,如果请求花费的时间超过10秒,我将无法获得任何数据。我试图在python代码中没有配置任何心跳:
s = zerorpc.Server(Test(), heartbeat=None)
Run Code Online (Sandbox Code Playgroud)
以及尝试配置node.js客户端:
new zerorpc.Client({ timeout: 60, heartbeatInterval: 60000 }),
Run Code Online (Sandbox Code Playgroud)
但仍然看到相同的行为。
如何获得超过10秒才能返回结果的请求?
Zerorpc-node 的最后一个可用版本 (0.9.3) 使用编码的 HEARBEAT 超时。
正如您在https://github.com/dotcloud/zerorpc-node/blob/0.9.3/lib/channel.js中看到的:
//Heartbeat rate in milliseconds
var HEARTBEAT = 5000;
...
//Resets the heartbeat expiration time
Channel.prototype._resetHeartbeat = function() {
this._heartbeatExpirationTime = util.curTime() + HEARTBEAT * 2;
};
Run Code Online (Sandbox Code Playgroud)
但是,当您尝试在客户端构造函数中指定时,最新的主版本实现了hearbeatInterval 选项。
然后您的代码可以使用以下命令安装最新的主版本
npm install git+https://github.com/dotcloud/zerorpc-node.git
Run Code Online (Sandbox Code Playgroud)
或者等待新版本发布......
归档时间: |
|
查看次数: |
1981 次 |
最近记录: |