gpt4 book ai didi

python - 如何配置 ZeroRPC 和超时

转载 作者:太空狗 更新时间:2023-10-30 01:38:11 26 4
gpt4 key购买 nike

我正在尝试使用 ZeroRPC python 服务器和 node.js 客户端进行一些简单的负载测试。我注意到,如果请求花费的时间超过 10 秒,我将得不到任何数据。我尝试在python代码中配置无心跳:

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

以及尝试配置 node.js 客户端:

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

但仍然看到相同的行为。

如何让请求返回结果的时间超过 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;
};

但是,当您尝试在客户端构造函数中指定时,最新的主版本会实现 hearbeatInterval 选项。

然后您的代码可以使用命令安装最新的 master

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

或者等待新版本....

关于python - 如何配置 ZeroRPC 和超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23203973/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com