How to configure ZeroRPC and timeouts

五迷三道 提交于 2019-12-10 14:33:13

问题


I'm trying to do some simple load-testing with a ZeroRPC python server and node.js client. What I notice is that if the request takes longer than 10 seconds, I get no data back. I tried to configure no heartbeat in the python code:

s = zerorpc.Server(Test(), heartbeat=None)

as well as trying to configure the node.js client:

new zerorpc.Client({ timeout: 60, heartbeatInterval: 60000 }),

but still see the same behavior.

How can I get requests taking longer than 10 seconds to return results?


回答1:


The last available release of zerorpc-node (0.9.3) use an harcoded HEARBEAT timeout.

As you can see in 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;
};

However the latest master release implement the hearbeatInterval option as you try to specify in the client contructor.

Then your code works installing the lastest master with the command

npm install git+https://github.com/dotcloud/zerorpc-node.git

Or wait for a new release ....



来源:https://stackoverflow.com/questions/23203973/how-to-configure-zerorpc-and-timeouts

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!